@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
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class JSI_EXPORT NativeRNFBTurboDatabaseCxxSpecJSI : public TurboModule {
|
|
19
|
+
protected:
|
|
20
|
+
NativeRNFBTurboDatabaseCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
virtual void goOnline(jsi::Runtime &rt, jsi::String app, jsi::String dbURL) = 0;
|
|
24
|
+
virtual void goOffline(jsi::Runtime &rt, jsi::String app, jsi::String dbURL) = 0;
|
|
25
|
+
virtual void setPersistenceEnabled(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, bool enabled) = 0;
|
|
26
|
+
virtual void setLoggingEnabled(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, bool enabled) = 0;
|
|
27
|
+
virtual void setPersistenceCacheSizeBytes(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, double cacheSizeBytes) = 0;
|
|
28
|
+
virtual void useEmulator(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String host, double port) = 0;
|
|
29
|
+
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
template <typename T>
|
|
33
|
+
class JSI_EXPORT NativeRNFBTurboDatabaseCxxSpec : public TurboModule {
|
|
34
|
+
public:
|
|
35
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
36
|
+
return delegate_.create(rt, propName);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
40
|
+
return delegate_.getPropertyNames(runtime);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static constexpr std::string_view kModuleName = "NativeRNFBTurboDatabase";
|
|
44
|
+
|
|
45
|
+
protected:
|
|
46
|
+
NativeRNFBTurboDatabaseCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
47
|
+
: TurboModule(std::string{NativeRNFBTurboDatabaseCxxSpec::kModuleName}, jsInvoker),
|
|
48
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
private:
|
|
52
|
+
class Delegate : public NativeRNFBTurboDatabaseCxxSpecJSI {
|
|
53
|
+
public:
|
|
54
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
55
|
+
NativeRNFBTurboDatabaseCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
void goOnline(jsi::Runtime &rt, jsi::String app, jsi::String dbURL) override {
|
|
60
|
+
static_assert(
|
|
61
|
+
bridging::getParameterCount(&T::goOnline) == 3,
|
|
62
|
+
"Expected goOnline(...) to have 3 parameters");
|
|
63
|
+
|
|
64
|
+
return bridging::callFromJs<void>(
|
|
65
|
+
rt, &T::goOnline, jsInvoker_, instance_, std::move(app), std::move(dbURL));
|
|
66
|
+
}
|
|
67
|
+
void goOffline(jsi::Runtime &rt, jsi::String app, jsi::String dbURL) override {
|
|
68
|
+
static_assert(
|
|
69
|
+
bridging::getParameterCount(&T::goOffline) == 3,
|
|
70
|
+
"Expected goOffline(...) to have 3 parameters");
|
|
71
|
+
|
|
72
|
+
return bridging::callFromJs<void>(
|
|
73
|
+
rt, &T::goOffline, jsInvoker_, instance_, std::move(app), std::move(dbURL));
|
|
74
|
+
}
|
|
75
|
+
void setPersistenceEnabled(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, bool enabled) override {
|
|
76
|
+
static_assert(
|
|
77
|
+
bridging::getParameterCount(&T::setPersistenceEnabled) == 4,
|
|
78
|
+
"Expected setPersistenceEnabled(...) to have 4 parameters");
|
|
79
|
+
|
|
80
|
+
return bridging::callFromJs<void>(
|
|
81
|
+
rt, &T::setPersistenceEnabled, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(enabled));
|
|
82
|
+
}
|
|
83
|
+
void setLoggingEnabled(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, bool enabled) override {
|
|
84
|
+
static_assert(
|
|
85
|
+
bridging::getParameterCount(&T::setLoggingEnabled) == 4,
|
|
86
|
+
"Expected setLoggingEnabled(...) to have 4 parameters");
|
|
87
|
+
|
|
88
|
+
return bridging::callFromJs<void>(
|
|
89
|
+
rt, &T::setLoggingEnabled, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(enabled));
|
|
90
|
+
}
|
|
91
|
+
void setPersistenceCacheSizeBytes(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, double cacheSizeBytes) override {
|
|
92
|
+
static_assert(
|
|
93
|
+
bridging::getParameterCount(&T::setPersistenceCacheSizeBytes) == 4,
|
|
94
|
+
"Expected setPersistenceCacheSizeBytes(...) to have 4 parameters");
|
|
95
|
+
|
|
96
|
+
return bridging::callFromJs<void>(
|
|
97
|
+
rt, &T::setPersistenceCacheSizeBytes, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(cacheSizeBytes));
|
|
98
|
+
}
|
|
99
|
+
void useEmulator(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String host, double port) override {
|
|
100
|
+
static_assert(
|
|
101
|
+
bridging::getParameterCount(&T::useEmulator) == 5,
|
|
102
|
+
"Expected useEmulator(...) to have 5 parameters");
|
|
103
|
+
|
|
104
|
+
return bridging::callFromJs<void>(
|
|
105
|
+
rt, &T::useEmulator, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(host), std::move(port));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private:
|
|
109
|
+
friend class NativeRNFBTurboDatabaseCxxSpec;
|
|
110
|
+
T *instance_;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
Delegate delegate_;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class JSI_EXPORT NativeRNFBTurboDatabaseOnDisconnectCxxSpecJSI : public TurboModule {
|
|
118
|
+
protected:
|
|
119
|
+
NativeRNFBTurboDatabaseOnDisconnectCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
120
|
+
|
|
121
|
+
public:
|
|
122
|
+
virtual jsi::Value onDisconnectCancel(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path) = 0;
|
|
123
|
+
virtual jsi::Value onDisconnectRemove(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path) = 0;
|
|
124
|
+
virtual jsi::Value onDisconnectSet(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Object props) = 0;
|
|
125
|
+
virtual jsi::Value onDisconnectSetWithPriority(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Object props) = 0;
|
|
126
|
+
virtual jsi::Value onDisconnectUpdate(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Object props) = 0;
|
|
127
|
+
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
template <typename T>
|
|
131
|
+
class JSI_EXPORT NativeRNFBTurboDatabaseOnDisconnectCxxSpec : public TurboModule {
|
|
132
|
+
public:
|
|
133
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
134
|
+
return delegate_.create(rt, propName);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
138
|
+
return delegate_.getPropertyNames(runtime);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
static constexpr std::string_view kModuleName = "NativeRNFBTurboDatabaseOnDisconnect";
|
|
142
|
+
|
|
143
|
+
protected:
|
|
144
|
+
NativeRNFBTurboDatabaseOnDisconnectCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
145
|
+
: TurboModule(std::string{NativeRNFBTurboDatabaseOnDisconnectCxxSpec::kModuleName}, jsInvoker),
|
|
146
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
private:
|
|
150
|
+
class Delegate : public NativeRNFBTurboDatabaseOnDisconnectCxxSpecJSI {
|
|
151
|
+
public:
|
|
152
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
153
|
+
NativeRNFBTurboDatabaseOnDisconnectCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
154
|
+
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
jsi::Value onDisconnectCancel(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path) override {
|
|
158
|
+
static_assert(
|
|
159
|
+
bridging::getParameterCount(&T::onDisconnectCancel) == 4,
|
|
160
|
+
"Expected onDisconnectCancel(...) to have 4 parameters");
|
|
161
|
+
|
|
162
|
+
return bridging::callFromJs<jsi::Value>(
|
|
163
|
+
rt, &T::onDisconnectCancel, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(path));
|
|
164
|
+
}
|
|
165
|
+
jsi::Value onDisconnectRemove(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path) override {
|
|
166
|
+
static_assert(
|
|
167
|
+
bridging::getParameterCount(&T::onDisconnectRemove) == 4,
|
|
168
|
+
"Expected onDisconnectRemove(...) to have 4 parameters");
|
|
169
|
+
|
|
170
|
+
return bridging::callFromJs<jsi::Value>(
|
|
171
|
+
rt, &T::onDisconnectRemove, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(path));
|
|
172
|
+
}
|
|
173
|
+
jsi::Value onDisconnectSet(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Object props) override {
|
|
174
|
+
static_assert(
|
|
175
|
+
bridging::getParameterCount(&T::onDisconnectSet) == 5,
|
|
176
|
+
"Expected onDisconnectSet(...) to have 5 parameters");
|
|
177
|
+
|
|
178
|
+
return bridging::callFromJs<jsi::Value>(
|
|
179
|
+
rt, &T::onDisconnectSet, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(path), std::move(props));
|
|
180
|
+
}
|
|
181
|
+
jsi::Value onDisconnectSetWithPriority(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Object props) override {
|
|
182
|
+
static_assert(
|
|
183
|
+
bridging::getParameterCount(&T::onDisconnectSetWithPriority) == 5,
|
|
184
|
+
"Expected onDisconnectSetWithPriority(...) to have 5 parameters");
|
|
185
|
+
|
|
186
|
+
return bridging::callFromJs<jsi::Value>(
|
|
187
|
+
rt, &T::onDisconnectSetWithPriority, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(path), std::move(props));
|
|
188
|
+
}
|
|
189
|
+
jsi::Value onDisconnectUpdate(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Object props) override {
|
|
190
|
+
static_assert(
|
|
191
|
+
bridging::getParameterCount(&T::onDisconnectUpdate) == 5,
|
|
192
|
+
"Expected onDisconnectUpdate(...) to have 5 parameters");
|
|
193
|
+
|
|
194
|
+
return bridging::callFromJs<jsi::Value>(
|
|
195
|
+
rt, &T::onDisconnectUpdate, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(path), std::move(props));
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
private:
|
|
199
|
+
friend class NativeRNFBTurboDatabaseOnDisconnectCxxSpec;
|
|
200
|
+
T *instance_;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
Delegate delegate_;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
class JSI_EXPORT NativeRNFBTurboDatabaseQueryCxxSpecJSI : public TurboModule {
|
|
208
|
+
protected:
|
|
209
|
+
NativeRNFBTurboDatabaseQueryCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
210
|
+
|
|
211
|
+
public:
|
|
212
|
+
virtual jsi::Value once(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Array modifiers, jsi::String eventType) = 0;
|
|
213
|
+
virtual void on(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::Object props) = 0;
|
|
214
|
+
virtual void off(jsi::Runtime &rt, jsi::String queryKey, jsi::String eventRegistrationKey) = 0;
|
|
215
|
+
virtual jsi::Value keepSynced(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String key, jsi::String path, jsi::Array modifiers, bool enabled) = 0;
|
|
216
|
+
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
template <typename T>
|
|
220
|
+
class JSI_EXPORT NativeRNFBTurboDatabaseQueryCxxSpec : public TurboModule {
|
|
221
|
+
public:
|
|
222
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
223
|
+
return delegate_.create(rt, propName);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
227
|
+
return delegate_.getPropertyNames(runtime);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
static constexpr std::string_view kModuleName = "NativeRNFBTurboDatabaseQuery";
|
|
231
|
+
|
|
232
|
+
protected:
|
|
233
|
+
NativeRNFBTurboDatabaseQueryCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
234
|
+
: TurboModule(std::string{NativeRNFBTurboDatabaseQueryCxxSpec::kModuleName}, jsInvoker),
|
|
235
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
private:
|
|
239
|
+
class Delegate : public NativeRNFBTurboDatabaseQueryCxxSpecJSI {
|
|
240
|
+
public:
|
|
241
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
242
|
+
NativeRNFBTurboDatabaseQueryCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
243
|
+
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
jsi::Value once(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Array modifiers, jsi::String eventType) override {
|
|
247
|
+
static_assert(
|
|
248
|
+
bridging::getParameterCount(&T::once) == 6,
|
|
249
|
+
"Expected once(...) to have 6 parameters");
|
|
250
|
+
|
|
251
|
+
return bridging::callFromJs<jsi::Value>(
|
|
252
|
+
rt, &T::once, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(path), std::move(modifiers), std::move(eventType));
|
|
253
|
+
}
|
|
254
|
+
void on(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::Object props) override {
|
|
255
|
+
static_assert(
|
|
256
|
+
bridging::getParameterCount(&T::on) == 4,
|
|
257
|
+
"Expected on(...) to have 4 parameters");
|
|
258
|
+
|
|
259
|
+
return bridging::callFromJs<void>(
|
|
260
|
+
rt, &T::on, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(props));
|
|
261
|
+
}
|
|
262
|
+
void off(jsi::Runtime &rt, jsi::String queryKey, jsi::String eventRegistrationKey) override {
|
|
263
|
+
static_assert(
|
|
264
|
+
bridging::getParameterCount(&T::off) == 3,
|
|
265
|
+
"Expected off(...) to have 3 parameters");
|
|
266
|
+
|
|
267
|
+
return bridging::callFromJs<void>(
|
|
268
|
+
rt, &T::off, jsInvoker_, instance_, std::move(queryKey), std::move(eventRegistrationKey));
|
|
269
|
+
}
|
|
270
|
+
jsi::Value keepSynced(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String key, jsi::String path, jsi::Array modifiers, bool enabled) override {
|
|
271
|
+
static_assert(
|
|
272
|
+
bridging::getParameterCount(&T::keepSynced) == 7,
|
|
273
|
+
"Expected keepSynced(...) to have 7 parameters");
|
|
274
|
+
|
|
275
|
+
return bridging::callFromJs<jsi::Value>(
|
|
276
|
+
rt, &T::keepSynced, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(key), std::move(path), std::move(modifiers), std::move(enabled));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
private:
|
|
280
|
+
friend class NativeRNFBTurboDatabaseQueryCxxSpec;
|
|
281
|
+
T *instance_;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
Delegate delegate_;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
class JSI_EXPORT NativeRNFBTurboDatabaseReferenceCxxSpecJSI : public TurboModule {
|
|
289
|
+
protected:
|
|
290
|
+
NativeRNFBTurboDatabaseReferenceCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
291
|
+
|
|
292
|
+
public:
|
|
293
|
+
virtual jsi::Value set(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Object props) = 0;
|
|
294
|
+
virtual jsi::Value update(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Object props) = 0;
|
|
295
|
+
virtual jsi::Value setWithPriority(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Object props) = 0;
|
|
296
|
+
virtual jsi::Value remove(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path) = 0;
|
|
297
|
+
virtual jsi::Value setPriority(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Object props) = 0;
|
|
298
|
+
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
template <typename T>
|
|
302
|
+
class JSI_EXPORT NativeRNFBTurboDatabaseReferenceCxxSpec : public TurboModule {
|
|
303
|
+
public:
|
|
304
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
305
|
+
return delegate_.create(rt, propName);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
309
|
+
return delegate_.getPropertyNames(runtime);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
static constexpr std::string_view kModuleName = "NativeRNFBTurboDatabaseReference";
|
|
313
|
+
|
|
314
|
+
protected:
|
|
315
|
+
NativeRNFBTurboDatabaseReferenceCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
316
|
+
: TurboModule(std::string{NativeRNFBTurboDatabaseReferenceCxxSpec::kModuleName}, jsInvoker),
|
|
317
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
private:
|
|
321
|
+
class Delegate : public NativeRNFBTurboDatabaseReferenceCxxSpecJSI {
|
|
322
|
+
public:
|
|
323
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
324
|
+
NativeRNFBTurboDatabaseReferenceCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
325
|
+
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
jsi::Value set(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Object props) override {
|
|
329
|
+
static_assert(
|
|
330
|
+
bridging::getParameterCount(&T::set) == 5,
|
|
331
|
+
"Expected set(...) to have 5 parameters");
|
|
332
|
+
|
|
333
|
+
return bridging::callFromJs<jsi::Value>(
|
|
334
|
+
rt, &T::set, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(path), std::move(props));
|
|
335
|
+
}
|
|
336
|
+
jsi::Value update(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Object props) override {
|
|
337
|
+
static_assert(
|
|
338
|
+
bridging::getParameterCount(&T::update) == 5,
|
|
339
|
+
"Expected update(...) to have 5 parameters");
|
|
340
|
+
|
|
341
|
+
return bridging::callFromJs<jsi::Value>(
|
|
342
|
+
rt, &T::update, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(path), std::move(props));
|
|
343
|
+
}
|
|
344
|
+
jsi::Value setWithPriority(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Object props) override {
|
|
345
|
+
static_assert(
|
|
346
|
+
bridging::getParameterCount(&T::setWithPriority) == 5,
|
|
347
|
+
"Expected setWithPriority(...) to have 5 parameters");
|
|
348
|
+
|
|
349
|
+
return bridging::callFromJs<jsi::Value>(
|
|
350
|
+
rt, &T::setWithPriority, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(path), std::move(props));
|
|
351
|
+
}
|
|
352
|
+
jsi::Value remove(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path) override {
|
|
353
|
+
static_assert(
|
|
354
|
+
bridging::getParameterCount(&T::remove) == 4,
|
|
355
|
+
"Expected remove(...) to have 4 parameters");
|
|
356
|
+
|
|
357
|
+
return bridging::callFromJs<jsi::Value>(
|
|
358
|
+
rt, &T::remove, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(path));
|
|
359
|
+
}
|
|
360
|
+
jsi::Value setPriority(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, jsi::Object props) override {
|
|
361
|
+
static_assert(
|
|
362
|
+
bridging::getParameterCount(&T::setPriority) == 5,
|
|
363
|
+
"Expected setPriority(...) to have 5 parameters");
|
|
364
|
+
|
|
365
|
+
return bridging::callFromJs<jsi::Value>(
|
|
366
|
+
rt, &T::setPriority, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(path), std::move(props));
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
private:
|
|
370
|
+
friend class NativeRNFBTurboDatabaseReferenceCxxSpec;
|
|
371
|
+
T *instance_;
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
Delegate delegate_;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
class JSI_EXPORT NativeRNFBTurboDatabaseTransactionCxxSpecJSI : public TurboModule {
|
|
379
|
+
protected:
|
|
380
|
+
NativeRNFBTurboDatabaseTransactionCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
381
|
+
|
|
382
|
+
public:
|
|
383
|
+
virtual void transactionStart(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, double transactionId, bool applyLocally) = 0;
|
|
384
|
+
virtual void transactionTryCommit(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, double transactionId, jsi::Object updates) = 0;
|
|
385
|
+
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
template <typename T>
|
|
389
|
+
class JSI_EXPORT NativeRNFBTurboDatabaseTransactionCxxSpec : public TurboModule {
|
|
390
|
+
public:
|
|
391
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
392
|
+
return delegate_.create(rt, propName);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
396
|
+
return delegate_.getPropertyNames(runtime);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
static constexpr std::string_view kModuleName = "NativeRNFBTurboDatabaseTransaction";
|
|
400
|
+
|
|
401
|
+
protected:
|
|
402
|
+
NativeRNFBTurboDatabaseTransactionCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
403
|
+
: TurboModule(std::string{NativeRNFBTurboDatabaseTransactionCxxSpec::kModuleName}, jsInvoker),
|
|
404
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
private:
|
|
408
|
+
class Delegate : public NativeRNFBTurboDatabaseTransactionCxxSpecJSI {
|
|
409
|
+
public:
|
|
410
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
411
|
+
NativeRNFBTurboDatabaseTransactionCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
412
|
+
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
void transactionStart(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, jsi::String path, double transactionId, bool applyLocally) override {
|
|
416
|
+
static_assert(
|
|
417
|
+
bridging::getParameterCount(&T::transactionStart) == 6,
|
|
418
|
+
"Expected transactionStart(...) to have 6 parameters");
|
|
419
|
+
|
|
420
|
+
return bridging::callFromJs<void>(
|
|
421
|
+
rt, &T::transactionStart, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(path), std::move(transactionId), std::move(applyLocally));
|
|
422
|
+
}
|
|
423
|
+
void transactionTryCommit(jsi::Runtime &rt, jsi::String app, jsi::String dbURL, double transactionId, jsi::Object updates) override {
|
|
424
|
+
static_assert(
|
|
425
|
+
bridging::getParameterCount(&T::transactionTryCommit) == 5,
|
|
426
|
+
"Expected transactionTryCommit(...) to have 5 parameters");
|
|
427
|
+
|
|
428
|
+
return bridging::callFromJs<void>(
|
|
429
|
+
rt, &T::transactionTryCommit, jsInvoker_, instance_, std::move(app), std::move(dbURL), std::move(transactionId), std::move(updates));
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
private:
|
|
433
|
+
friend class NativeRNFBTurboDatabaseTransactionCxxSpec;
|
|
434
|
+
T *instance_;
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
Delegate delegate_;
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
version = "0.78.3"
|
|
7
|
+
source = { :git => 'https://github.com/facebook/react-native.git' }
|
|
8
|
+
if version == '1000.0.0'
|
|
9
|
+
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
|
|
10
|
+
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
|
|
11
|
+
else
|
|
12
|
+
source[:tag] = "v#{version}"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
Pod::Spec.new do |s|
|
|
16
|
+
s.name = "ReactAppDependencyProvider"
|
|
17
|
+
s.version = version
|
|
18
|
+
s.summary = "The third party dependency provider for the app"
|
|
19
|
+
s.homepage = "https://reactnative.dev/"
|
|
20
|
+
s.documentation_url = "https://reactnative.dev/"
|
|
21
|
+
s.license = "MIT"
|
|
22
|
+
s.author = "Meta Platforms, Inc. and its affiliates"
|
|
23
|
+
s.platforms = min_supported_versions
|
|
24
|
+
s.source = source
|
|
25
|
+
s.source_files = "**/RCTAppDependencyProvider.{h,mm}"
|
|
26
|
+
|
|
27
|
+
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
|
|
28
|
+
s.pod_target_xcconfig = {
|
|
29
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
|
|
30
|
+
"DEFINES_MODULE" => "YES"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
s.dependency "ReactCodegen"
|
|
34
|
+
end
|
|
@@ -16,40 +16,33 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import {
|
|
19
|
-
createDeprecationProxy,
|
|
20
19
|
isArray,
|
|
21
20
|
isFunction,
|
|
22
21
|
isNumber,
|
|
23
22
|
isObject,
|
|
24
23
|
isString,
|
|
25
|
-
MODULAR_DEPRECATION_ARG,
|
|
26
24
|
} from '@react-native-firebase/app/dist/module/common';
|
|
27
25
|
import { deepGet } from '@react-native-firebase/app/dist/module/common/deeps';
|
|
28
26
|
|
|
29
|
-
import type {
|
|
30
|
-
|
|
27
|
+
import type {
|
|
28
|
+
DatabaseReferenceWithMethodsInternal,
|
|
29
|
+
DatabaseSnapshotInternal,
|
|
30
|
+
} from './types/internal';
|
|
31
|
+
import type { DatabaseReference, DataSnapshot, IteratedDataSnapshot } from './types/database';
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
function ap(reference: FirebaseDatabaseTypes.Reference): ReferenceWithDeprecationArg {
|
|
37
|
-
return reference as ReferenceWithDeprecationArg;
|
|
33
|
+
function ap(reference: DatabaseReference): DatabaseReferenceWithMethodsInternal {
|
|
34
|
+
return reference as DatabaseReferenceWithMethodsInternal;
|
|
38
35
|
}
|
|
39
36
|
|
|
40
|
-
export default class DatabaseDataSnapshot implements
|
|
37
|
+
export default class DatabaseDataSnapshot implements DataSnapshot {
|
|
41
38
|
_snapshot: DatabaseSnapshotInternal;
|
|
42
|
-
_ref:
|
|
39
|
+
_ref: DatabaseReference;
|
|
43
40
|
|
|
44
|
-
constructor(reference:
|
|
41
|
+
constructor(reference: DatabaseReference, snapshot: DatabaseSnapshotInternal) {
|
|
45
42
|
this._snapshot = snapshot;
|
|
46
43
|
|
|
47
44
|
if (reference.key !== snapshot.key && isString(snapshot.key)) {
|
|
48
|
-
this._ref = ap(reference.ref).child.
|
|
49
|
-
reference.ref,
|
|
50
|
-
snapshot.key,
|
|
51
|
-
MODULAR_DEPRECATION_ARG,
|
|
52
|
-
);
|
|
45
|
+
this._ref = ap(reference.ref).child(snapshot.key);
|
|
53
46
|
} else {
|
|
54
47
|
this._ref = reference;
|
|
55
48
|
}
|
|
@@ -59,11 +52,11 @@ export default class DatabaseDataSnapshot implements FirebaseDatabaseTypes.DataS
|
|
|
59
52
|
return this._snapshot.key;
|
|
60
53
|
}
|
|
61
54
|
|
|
62
|
-
get ref():
|
|
55
|
+
get ref(): DatabaseReference {
|
|
63
56
|
return this._ref;
|
|
64
57
|
}
|
|
65
58
|
|
|
66
|
-
child(path: string):
|
|
59
|
+
child(path: string): DataSnapshot {
|
|
67
60
|
if (!isString(path)) {
|
|
68
61
|
throw new Error("snapshot().child(*) 'path' must be a string value");
|
|
69
62
|
}
|
|
@@ -75,7 +68,7 @@ export default class DatabaseDataSnapshot implements FirebaseDatabaseTypes.DataS
|
|
|
75
68
|
value = null;
|
|
76
69
|
}
|
|
77
70
|
|
|
78
|
-
const childRef = ap(this._ref).child
|
|
71
|
+
const childRef = ap(this._ref).child(path);
|
|
79
72
|
|
|
80
73
|
let childPriority: string | number | null = null;
|
|
81
74
|
if (this._snapshot.childPriorities) {
|
|
@@ -85,15 +78,13 @@ export default class DatabaseDataSnapshot implements FirebaseDatabaseTypes.DataS
|
|
|
85
78
|
}
|
|
86
79
|
}
|
|
87
80
|
|
|
88
|
-
return
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}),
|
|
96
|
-
) as FirebaseDatabaseTypes.DataSnapshot;
|
|
81
|
+
return new DatabaseDataSnapshot(childRef, {
|
|
82
|
+
value,
|
|
83
|
+
key: childRef.key,
|
|
84
|
+
exists: value !== null,
|
|
85
|
+
childKeys: isObject(value) ? Object.keys(value as Record<string, unknown>) : [],
|
|
86
|
+
priority: childPriority,
|
|
87
|
+
});
|
|
97
88
|
}
|
|
98
89
|
|
|
99
90
|
exists(): boolean {
|
|
@@ -113,19 +104,16 @@ export default class DatabaseDataSnapshot implements FirebaseDatabaseTypes.DataS
|
|
|
113
104
|
};
|
|
114
105
|
}
|
|
115
106
|
|
|
116
|
-
forEach(action: (child:
|
|
107
|
+
forEach(action: (child: IteratedDataSnapshot) => boolean | void): boolean {
|
|
117
108
|
if (!isFunction(action)) {
|
|
118
109
|
throw new Error("snapshot.forEach(*) 'action' must be a function.");
|
|
119
110
|
}
|
|
120
111
|
|
|
121
|
-
const iterate = action as (
|
|
122
|
-
child: FirebaseDatabaseTypes.DataSnapshot,
|
|
123
|
-
index?: number,
|
|
124
|
-
) => boolean | void;
|
|
112
|
+
const iterate = action as (child: IteratedDataSnapshot, index?: number) => boolean | void;
|
|
125
113
|
|
|
126
114
|
if (isArray(this._snapshot.value)) {
|
|
127
115
|
return this._snapshot.value.some(
|
|
128
|
-
(_value, i) => iterate(this.child(i.toString()), i) === true,
|
|
116
|
+
(_value, i) => iterate(this.child(i.toString()) as IteratedDataSnapshot, i) === true,
|
|
129
117
|
);
|
|
130
118
|
}
|
|
131
119
|
|
|
@@ -141,7 +129,7 @@ export default class DatabaseDataSnapshot implements FirebaseDatabaseTypes.DataS
|
|
|
141
129
|
continue;
|
|
142
130
|
}
|
|
143
131
|
const snapshot = this.child(key);
|
|
144
|
-
const actionReturn = iterate(snapshot, i);
|
|
132
|
+
const actionReturn = iterate(snapshot as IteratedDataSnapshot, i);
|
|
145
133
|
|
|
146
134
|
if (actionReturn === true) {
|
|
147
135
|
cancelled = true;
|
|
@@ -152,10 +140,27 @@ export default class DatabaseDataSnapshot implements FirebaseDatabaseTypes.DataS
|
|
|
152
140
|
return cancelled;
|
|
153
141
|
}
|
|
154
142
|
|
|
155
|
-
|
|
143
|
+
get priority(): string | number | null {
|
|
156
144
|
return this._snapshot.priority ?? null;
|
|
157
145
|
}
|
|
158
146
|
|
|
147
|
+
get size(): number {
|
|
148
|
+
const value = this.val();
|
|
149
|
+
if (value === null) {
|
|
150
|
+
return 4;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
try {
|
|
154
|
+
return JSON.stringify(value).length;
|
|
155
|
+
} catch {
|
|
156
|
+
return 0;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
getPriority(): string | number | null {
|
|
161
|
+
return this.priority;
|
|
162
|
+
}
|
|
163
|
+
|
|
159
164
|
hasChild(path: string): boolean {
|
|
160
165
|
if (!isString(path)) {
|
|
161
166
|
throw new Error("snapshot.hasChild(*) 'path' must be a string value.");
|
|
@@ -27,14 +27,14 @@ import {
|
|
|
27
27
|
} from '@react-native-firebase/app/dist/module/common';
|
|
28
28
|
|
|
29
29
|
import type { DatabaseModuleInternal } from './types/internal';
|
|
30
|
-
import type {
|
|
30
|
+
import type { OnDisconnect } from './types/database';
|
|
31
31
|
|
|
32
32
|
interface DatabaseOnDisconnectReferenceInternal {
|
|
33
33
|
readonly path: string;
|
|
34
34
|
readonly _database: DatabaseModuleInternal;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export default class DatabaseOnDisconnect implements
|
|
37
|
+
export default class DatabaseOnDisconnect implements OnDisconnect {
|
|
38
38
|
_ref: DatabaseOnDisconnectReferenceInternal;
|
|
39
39
|
|
|
40
40
|
constructor(reference: DatabaseOnDisconnectReferenceInternal) {
|
|
@@ -86,7 +86,7 @@ export default class DatabaseOnDisconnect implements FirebaseDatabaseTypes.OnDis
|
|
|
86
86
|
|
|
87
87
|
setWithPriority(
|
|
88
88
|
value: any,
|
|
89
|
-
priority:
|
|
89
|
+
priority: number | string | null,
|
|
90
90
|
onComplete?: (error: Error | null) => void,
|
|
91
91
|
): Promise<void> {
|
|
92
92
|
if (isUndefined(value)) {
|