react-native-mosquito-transport 0.0.57 → 0.0.58
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/package.json +1 -1
- package/src/index.d.ts +2 -0
- package/src/index.js +11 -4
- package/src/products/database/index.js +9 -3
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -182,6 +182,8 @@ interface CustomSocketOption extends OveridenProjectUrl {
|
|
|
182
182
|
export default class RNMT {
|
|
183
183
|
constructor(config: RNMTConfig);
|
|
184
184
|
static initializeCache(option?: ReleaseCacheOption): void;
|
|
185
|
+
get isOnline(): boolean | undefined;
|
|
186
|
+
areYouOnline(): Promise<boolean>;
|
|
185
187
|
getDatabase(dbName?: string, dbUrl?: string): GetDatabase;
|
|
186
188
|
collection(path: string): RNMTCollection;
|
|
187
189
|
auth(): RNMTAuth;
|
package/src/index.js
CHANGED
|
@@ -142,6 +142,14 @@ class RNMT {
|
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
get isOnline() {
|
|
146
|
+
return Scoped.IS_CONNECTED[this.config.projectUrl];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
areYouOnline() {
|
|
150
|
+
return checkAreYouOk(this.config.projectUrl);
|
|
151
|
+
}
|
|
152
|
+
|
|
145
153
|
getDatabase = (dbName, dbUrl) => {
|
|
146
154
|
if (dbName) ConfigValidator.dbName(dbName);
|
|
147
155
|
if (dbUrl) ConfigValidator.dbUrl(dbUrl);
|
|
@@ -467,11 +475,10 @@ class RNMT {
|
|
|
467
475
|
clearForegroundListener();
|
|
468
476
|
clearSocket();
|
|
469
477
|
socketListenerList = [];
|
|
470
|
-
if (
|
|
471
|
-
|
|
478
|
+
if (socketReadyCallback) {
|
|
479
|
+
socketReadyCallback[1]('socket already disconnected');
|
|
480
|
+
socketReadyCallback = undefined;
|
|
472
481
|
}
|
|
473
|
-
socketReadyCallback[1]('socket already disconnected');
|
|
474
|
-
socketReadyCallback = undefined;
|
|
475
482
|
}
|
|
476
483
|
};
|
|
477
484
|
|
|
@@ -728,10 +728,15 @@ const findObject = async (builder, initConfig) => {
|
|
|
728
728
|
} else if (retries > maxRetries) {
|
|
729
729
|
finalize(undefined, { error: 'retry_limit_exceeded', message: `retry exceed limit(${maxRetries})` });
|
|
730
730
|
} else {
|
|
731
|
-
awaitReachableServer(projectUrl, true).then(() => {
|
|
731
|
+
awaitReachableServer(projectUrl, true).then(async () => {
|
|
732
732
|
if (intruder) {
|
|
733
733
|
intruder.resolve = undefined;
|
|
734
734
|
intruder.reject = undefined;
|
|
735
|
+
|
|
736
|
+
if (Scoped.dispatchingWritesPromise[projectUrl]) {
|
|
737
|
+
await Scoped.dispatchingWritesPromise[projectUrl];
|
|
738
|
+
}
|
|
739
|
+
|
|
735
740
|
readValue().then(
|
|
736
741
|
e => { finalize(e); },
|
|
737
742
|
e => { finalize(undefined, e); }
|
|
@@ -880,8 +885,9 @@ const commitData = async (builder, value, type, config) => {
|
|
|
880
885
|
e => { finalize(undefined, e.b, e.c); }
|
|
881
886
|
);
|
|
882
887
|
});
|
|
883
|
-
} else if (shouldCache)
|
|
884
|
-
|
|
888
|
+
} else if (shouldCache) {
|
|
889
|
+
finalize({ status: 'queued' });
|
|
890
|
+
} else finalize(undefined, simplifyCaughtError(e).simpleError);
|
|
885
891
|
}
|
|
886
892
|
}
|
|
887
893
|
});
|