react-native-mosquito-transport 0.0.18 → 0.0.19
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/TODO +3 -1
- package/example/ios/MosquitodbExample.xcodeproj/project.pbxproj +6 -5
- package/example/ios/MosquitodbExample.xcworkspace/contents.xcworkspacedata +10 -0
- package/example/ios/MosquitodbExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/example/ios/MosquitodbExample.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/example/ios/MosquitodbExample.xcworkspace/xcuserdata/anthony.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/MosquitodbExample.xcworkspace/xcuserdata/anthony.xcuserdatad/WorkspaceSettings.xcsettings +14 -0
- package/package.json +6 -5
- package/src/index.js +31 -29
- package/src/products/database/index.js +4 -4
package/TODO
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
- fix local cache query on sqlite and fs
|
|
2
2
|
- fix and add all mongodb query and update operator
|
|
3
3
|
- reauthenticate
|
|
4
|
-
- change `Object` in d.ts to [key: string]: any
|
|
4
|
+
- change `Object` in d.ts to [key: string]: any
|
|
5
|
+
- add `getServerTimeOffset` method
|
|
6
|
+
- change null to undefined in `value`
|
|
@@ -354,7 +354,6 @@
|
|
|
354
354
|
);
|
|
355
355
|
name = "[CP] Copy Pods Resources";
|
|
356
356
|
outputFileListPaths = (
|
|
357
|
-
"${PODS_ROOT}/Target Support Files/Pods-MosquitodbExample/Pods-MosquitodbExample-resources-${CONFIGURATION}-output-files.xcfilelist",
|
|
358
357
|
);
|
|
359
358
|
runOnlyForDeploymentPostprocessing = 0;
|
|
360
359
|
shellPath = /bin/sh;
|
|
@@ -501,7 +500,7 @@
|
|
|
501
500
|
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
|
|
502
501
|
PRODUCT_NAME = MosquitodbExample;
|
|
503
502
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
|
504
|
-
SWIFT_VERSION = 5.
|
|
503
|
+
SWIFT_VERSION = 5.3;
|
|
505
504
|
VERSIONING_SYSTEM = "apple-generic";
|
|
506
505
|
};
|
|
507
506
|
name = Debug;
|
|
@@ -526,7 +525,7 @@
|
|
|
526
525
|
);
|
|
527
526
|
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
|
|
528
527
|
PRODUCT_NAME = MosquitodbExample;
|
|
529
|
-
SWIFT_VERSION = 5.
|
|
528
|
+
SWIFT_VERSION = 5.3;
|
|
530
529
|
VERSIONING_SYSTEM = "apple-generic";
|
|
531
530
|
};
|
|
532
531
|
name = Release;
|
|
@@ -564,7 +563,7 @@
|
|
|
564
563
|
COPY_PHASE_STRIP = NO;
|
|
565
564
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
566
565
|
ENABLE_TESTABILITY = YES;
|
|
567
|
-
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" =
|
|
566
|
+
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
|
|
568
567
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
569
568
|
GCC_DYNAMIC_NO_PIC = NO;
|
|
570
569
|
GCC_NO_COMMON_BLOCKS = YES;
|
|
@@ -598,6 +597,7 @@
|
|
|
598
597
|
"-DFOLLY_MOBILE=1",
|
|
599
598
|
"-DFOLLY_USE_LIBCPP=1",
|
|
600
599
|
);
|
|
600
|
+
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
|
|
601
601
|
SDKROOT = iphoneos;
|
|
602
602
|
};
|
|
603
603
|
name = Debug;
|
|
@@ -635,7 +635,7 @@
|
|
|
635
635
|
COPY_PHASE_STRIP = YES;
|
|
636
636
|
ENABLE_NS_ASSERTIONS = NO;
|
|
637
637
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
638
|
-
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" =
|
|
638
|
+
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
|
|
639
639
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
640
640
|
GCC_NO_COMMON_BLOCKS = YES;
|
|
641
641
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
@@ -661,6 +661,7 @@
|
|
|
661
661
|
"-DFOLLY_MOBILE=1",
|
|
662
662
|
"-DFOLLY_USE_LIBCPP=1",
|
|
663
663
|
);
|
|
664
|
+
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
|
|
664
665
|
SDKROOT = iphoneos;
|
|
665
666
|
VALIDATE_PRODUCT = YES;
|
|
666
667
|
};
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>BuildLocationStyle</key>
|
|
6
|
+
<string>UseAppPreferences</string>
|
|
7
|
+
<key>CustomBuildLocationType</key>
|
|
8
|
+
<string>RelativeToDerivedData</string>
|
|
9
|
+
<key>DerivedDataLocationStyle</key>
|
|
10
|
+
<string>Default</string>
|
|
11
|
+
<key>ShowSharedSchemesAutomaticallyEnabled</key>
|
|
12
|
+
<true/>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-mosquito-transport",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "React native javascript sdk for mosquito-transport (https://github.com/deflexable/mosquito-transport)",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"buffer": "^6.0.3",
|
|
32
32
|
"crypto-js": "^4.2.0",
|
|
33
33
|
"fast-json-stable-stringify": "^2.1.0",
|
|
34
|
-
"guard-object": "^1.0.
|
|
34
|
+
"guard-object": "^1.0.9",
|
|
35
35
|
"json-buffer": "^3.0.1",
|
|
36
36
|
"lodash.get": "^4.4.2",
|
|
37
37
|
"lodash.isequal": "^4.5.0",
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"subscription-listener": "^1.1.2",
|
|
44
44
|
"tweetnacl": "^1.0.3"
|
|
45
45
|
},
|
|
46
|
-
"
|
|
47
|
-
"
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"react": "*",
|
|
48
|
+
"react-native": "*"
|
|
48
49
|
}
|
|
49
|
-
}
|
|
50
|
+
}
|
package/src/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { MTAuth } from "./products/auth";
|
|
|
6
6
|
import { MTCollection, batchWrite } from "./products/database";
|
|
7
7
|
import { MTStorage } from "./products/storage";
|
|
8
8
|
import { ServerReachableListener, TokenRefreshListener } from "./helpers/listeners";
|
|
9
|
-
import { initTokenRefresher, listenToken, listenTokenReady,
|
|
9
|
+
import { initTokenRefresher, listenToken, listenTokenReady, triggerAuthToken } from "./products/auth/accessor";
|
|
10
10
|
import { TIMESTAMP, DOCUMENT_EXTRACTION, FIND_GEO_JSON, GEO_JSON } from "./products/database/types";
|
|
11
11
|
import { mfetch } from "./products/http_callable";
|
|
12
12
|
import { io } from "socket.io-client";
|
|
@@ -48,40 +48,42 @@ class RNMT {
|
|
|
48
48
|
triggerAuthToken(projectUrl);
|
|
49
49
|
initTokenRefresher({ ...this.config }, true);
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
let socket, lastUid, lastSocketProcess = 0, hasInited;
|
|
51
|
+
let isConnected, lastSentToken, queuedToken;
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
const socket = io(`${this.config.wsPrefix}://${projectUrl.split('://')[1]}`, {
|
|
54
|
+
auth: {
|
|
55
|
+
_m_internal: true,
|
|
56
|
+
_from_base: true
|
|
57
|
+
}
|
|
58
|
+
});
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
lastUid = thisUid;
|
|
60
|
+
socket.on('_signal_signout', () => {
|
|
61
|
+
this.auth().signOut();
|
|
62
|
+
});
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
socket.on('connect', () => {
|
|
65
|
+
isConnected = true;
|
|
66
|
+
if (queuedToken) updateMountedToken(queuedToken.token);
|
|
67
|
+
ServerReachableListener.dispatch(projectUrl, true);
|
|
68
|
+
});
|
|
64
69
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
_from_base: true,
|
|
70
|
-
atoken: token
|
|
71
|
-
}
|
|
72
|
-
});
|
|
70
|
+
socket.on('disconnect', () => {
|
|
71
|
+
isConnected = false;
|
|
72
|
+
ServerReachableListener.dispatch(projectUrl, false);
|
|
73
|
+
});
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
const updateMountedToken = (token) => {
|
|
76
|
+
if ((lastSentToken || null) !== (token || null)) {
|
|
77
|
+
socket.emit('_update_mounted_user', token || null);
|
|
78
|
+
lastSentToken = token;
|
|
79
|
+
}
|
|
80
|
+
queuedToken = undefined;
|
|
81
|
+
}
|
|
77
82
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (!disconnectionGlich[thisProcess])
|
|
83
|
-
ServerReachableListener.dispatch(projectUrl, false);
|
|
84
|
-
});
|
|
83
|
+
listenToken(token => {
|
|
84
|
+
if (isConnected) {
|
|
85
|
+
updateMountedToken(token);
|
|
86
|
+
} else queuedToken = { token };
|
|
85
87
|
}, projectUrl);
|
|
86
88
|
|
|
87
89
|
listenReachableServer(c => {
|
|
@@ -69,8 +69,8 @@ export class MTCollection {
|
|
|
69
69
|
updateMany: (find, value) => initOnDisconnectionTask({ ...this.builder, command: { find } }, value, 'updateMany'),
|
|
70
70
|
mergeOne: (find, value) => initOnDisconnectionTask({ ...this.builder, command: { find } }, value, 'mergeOne'),
|
|
71
71
|
mergeMany: (find, value) => initOnDisconnectionTask({ ...this.builder, command: { find } }, value, 'mergeMany'),
|
|
72
|
-
deleteOne: (find) => initOnDisconnectionTask({ ...this.builder, command: { find } },
|
|
73
|
-
deleteMany: (find) => initOnDisconnectionTask({ ...this.builder, command: { find } },
|
|
72
|
+
deleteOne: (find) => initOnDisconnectionTask({ ...this.builder, command: { find } }, undefined, 'deleteOne'),
|
|
73
|
+
deleteMany: (find) => initOnDisconnectionTask({ ...this.builder, command: { find } }, undefined, 'deleteMany'),
|
|
74
74
|
replaceOne: (find, value) => initOnDisconnectionTask({ ...this.builder, command: { find } }, value, 'replaceOne'),
|
|
75
75
|
putOne: (find, value) => initOnDisconnectionTask({ ...this.builder, command: { find } }, value, 'putOne')
|
|
76
76
|
})
|
|
@@ -91,9 +91,9 @@ export class MTCollection {
|
|
|
91
91
|
|
|
92
92
|
putOne = (find, value, config) => commitData({ ...this.builder, find }, value, 'putOne', config);
|
|
93
93
|
|
|
94
|
-
deleteOne = (find, config) => commitData({ ...this.builder, find },
|
|
94
|
+
deleteOne = (find, config) => commitData({ ...this.builder, find }, undefined, 'deleteOne', config);
|
|
95
95
|
|
|
96
|
-
deleteMany = (find, config) => commitData({ ...this.builder, find },
|
|
96
|
+
deleteMany = (find, config) => commitData({ ...this.builder, find }, undefined, 'deleteMany', config);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
export const batchWrite = (builder, map, config) => commitData({ ...builder }, map, 'batchWrite', config);
|