react-native-mosquito-transport 0.0.30 → 0.0.31

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-mosquito-transport",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
4
4
  "description": "React native javascript sdk for mosquito-transport (https://github.com/brainbehindx/mosquito-transport)",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -27,19 +27,18 @@
27
27
  },
28
28
  "homepage": "https://github.com/brainbehindx/react-native-mosquito-transport#readme",
29
29
  "dependencies": {
30
- "@turf/turf": "^7.1.0",
30
+ "@turf/turf": "^7.2.0",
31
31
  "bson": "^6.8.0",
32
32
  "buffer": "^6.0.3",
33
33
  "entity-serializer": "^1.0.3",
34
34
  "guard-object": "^1.1.4",
35
35
  "lodash": "^4.17.21",
36
36
  "simplify-error": "^1.0.1",
37
- "socket.io-client": "^4.6.2",
37
+ "socket.io-client": "^4.8.1",
38
38
  "subscription-listener": "^1.1.2",
39
39
  "tweetnacl": "^1.0.3"
40
40
  },
41
41
  "peerDependencies": {
42
- "react": "*",
43
42
  "react-native": "*",
44
43
  "react-native-fs": "*",
45
44
  "react-native-sha256": "*",
package/src/index.d.ts CHANGED
@@ -146,6 +146,10 @@ interface RNMTSocket {
146
146
  on: (route: string, callback?: () => any) => void;
147
147
  once: (route: string, callback?: () => any) => void;
148
148
  destroy: () => void;
149
+ /**
150
+ * Whether the socket is currently disconnected
151
+ */
152
+ disconnected: boolean;
149
153
  }
150
154
 
151
155
  interface BatchWriteValue {
package/src/index.js CHANGED
@@ -321,8 +321,8 @@ class RNMT {
321
321
  lastTokenStatus = status || false;
322
322
  }, projectUrl);
323
323
  }
324
- // TODO: disconnected
325
- return {
324
+
325
+ const resultant = {
326
326
  timeout: (timeout) => {
327
327
  if (timeout !== undefined && !Validator.POSITIVE_INTEGER(timeout))
328
328
  throw `expected a positive integer for timeout but got ${timeout}`;
@@ -378,7 +378,17 @@ class RNMT {
378
378
  if (socket) socket.close();
379
379
  socketListenerList = [];
380
380
  }
381
- }
381
+ };
382
+
383
+ Object.defineProperty(resultant, 'disconnected', {
384
+ get() {
385
+ return socket.disconnected;
386
+ },
387
+ enumerable: true,
388
+ configurable: false
389
+ });
390
+
391
+ return resultant;
382
392
  }
383
393
  };
384
394