parse 5.0.0 → 5.1.0-alpha.10
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/README.md +13 -0
- package/dist/parse.js +1462 -1051
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +2361 -1086
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +48 -171
- package/lib/browser/InstallationController.js +134 -23
- package/lib/browser/LiveQueryClient.js +43 -35
- package/lib/browser/LiveQuerySubscription.js +15 -5
- package/lib/browser/LocalDatastoreController.default.js +248 -0
- package/lib/browser/LocalDatastoreController.js +1 -246
- package/lib/browser/ObjectStateMutations.js +6 -5
- package/lib/browser/OfflineQuery.js +3 -2
- package/lib/browser/Parse.js +31 -7
- package/lib/browser/ParseACL.js +21 -11
- package/lib/browser/ParseFile.js +4 -0
- package/lib/browser/ParseHooks.js +2 -0
- package/lib/browser/ParseInstallation.js +274 -13
- package/lib/browser/ParseLiveQuery.js +32 -23
- package/lib/browser/ParseObject.js +45 -45
- package/lib/browser/ParseOp.js +21 -7
- package/lib/browser/ParseQuery.js +1 -0
- package/lib/browser/ParseRelation.js +12 -7
- package/lib/browser/ParseRole.js +2 -0
- package/lib/browser/ParseSession.js +1 -1
- package/lib/browser/ParseUser.js +52 -21
- package/lib/browser/RESTController.js +7 -2
- package/lib/browser/SingleInstanceStateController.js +2 -4
- package/lib/browser/Storage.js +1 -2
- package/lib/browser/StorageController.js +3 -0
- package/lib/browser/WebSocketController.js +13 -0
- package/lib/browser/arrayContainsObject.js +4 -3
- package/lib/browser/canBeSerialized.js +6 -4
- package/lib/browser/decode.js +8 -5
- package/lib/browser/encode.js +6 -4
- package/lib/browser/equals.js +4 -3
- package/lib/browser/unique.js +3 -2
- package/lib/browser/unsavedChildren.js +4 -2
- package/lib/browser/uuid.js +11 -5
- package/lib/node/CoreManager.js +48 -171
- package/lib/node/InstallationController.js +65 -21
- package/lib/node/LiveQueryClient.js +2 -5
- package/lib/node/LiveQuerySubscription.js +2 -2
- package/lib/node/LocalDatastoreController.default.js +67 -0
- package/lib/node/LocalDatastoreController.js +1 -65
- package/lib/node/ObjectStateMutations.js +8 -9
- package/lib/node/OfflineQuery.js +3 -2
- package/lib/node/Parse.js +31 -7
- package/lib/node/ParseACL.js +21 -11
- package/lib/node/ParseFile.js +4 -0
- package/lib/node/ParseHooks.js +2 -0
- package/lib/node/ParseInstallation.js +207 -7
- package/lib/node/ParseLiveQuery.js +2 -3
- package/lib/node/ParseObject.js +17 -17
- package/lib/node/ParseOp.js +21 -7
- package/lib/node/ParseQuery.js +1 -0
- package/lib/node/ParseRelation.js +14 -8
- package/lib/node/ParseRole.js +2 -0
- package/lib/node/ParseSession.js +1 -1
- package/lib/node/ParseUser.js +21 -19
- package/lib/node/RESTController.js +6 -2
- package/lib/node/SingleInstanceStateController.js +2 -8
- package/lib/node/Storage.js +1 -2
- package/lib/node/StorageController.js +3 -0
- package/lib/node/WebSocketController.js +10 -0
- package/lib/node/arrayContainsObject.js +4 -3
- package/lib/node/canBeSerialized.js +6 -4
- package/lib/node/decode.js +9 -5
- package/lib/node/encode.js +7 -4
- package/lib/node/equals.js +4 -3
- package/lib/node/unique.js +3 -2
- package/lib/node/unsavedChildren.js +4 -2
- package/lib/node/uuid.js +10 -8
- package/lib/react-native/CoreManager.js +39 -2
- package/lib/react-native/InstallationController.js +77 -9
- package/lib/react-native/LiveQueryClient.js +28 -20
- package/lib/react-native/LiveQuerySubscription.js +14 -5
- package/lib/react-native/LocalDatastoreController.default.js +91 -0
- package/lib/react-native/LocalDatastoreController.js +1 -91
- package/lib/react-native/ObjectStateMutations.js +6 -5
- package/lib/react-native/OfflineQuery.js +3 -2
- package/lib/react-native/Parse.js +23 -7
- package/lib/react-native/ParseACL.js +19 -11
- package/lib/react-native/ParseInstallation.js +115 -10
- package/lib/react-native/ParseLiveQuery.js +11 -2
- package/lib/react-native/ParseObject.js +36 -36
- package/lib/react-native/ParseOp.js +20 -6
- package/lib/react-native/ParseQuery.js +1 -0
- package/lib/react-native/ParseRelation.js +10 -7
- package/lib/react-native/ParseRole.js +2 -0
- package/lib/react-native/ParseUser.js +7 -8
- package/lib/react-native/RESTController.js +5 -2
- package/lib/react-native/SingleInstanceStateController.js +0 -2
- package/lib/react-native/Storage.js +1 -2
- package/lib/react-native/StorageController.js +1 -0
- package/lib/react-native/WebSocketController.js +5 -0
- package/lib/react-native/arrayContainsObject.js +3 -2
- package/lib/react-native/canBeSerialized.js +5 -3
- package/lib/react-native/decode.js +7 -5
- package/lib/react-native/encode.js +6 -4
- package/lib/react-native/equals.js +4 -3
- package/lib/react-native/unique.js +3 -2
- package/lib/react-native/unsavedChildren.js +3 -2
- package/lib/react-native/uuid.js +9 -4
- package/lib/weapp/CoreManager.js +48 -171
- package/lib/weapp/InstallationController.js +134 -23
- package/lib/weapp/LiveQueryClient.js +43 -35
- package/lib/weapp/LiveQuerySubscription.js +15 -5
- package/lib/weapp/LocalDatastoreController.default.js +248 -0
- package/lib/weapp/LocalDatastoreController.js +1 -246
- package/lib/weapp/ObjectStateMutations.js +6 -5
- package/lib/weapp/OfflineQuery.js +3 -2
- package/lib/weapp/Parse.js +31 -7
- package/lib/weapp/ParseACL.js +21 -11
- package/lib/weapp/ParseFile.js +4 -0
- package/lib/weapp/ParseHooks.js +2 -0
- package/lib/weapp/ParseInstallation.js +274 -13
- package/lib/weapp/ParseLiveQuery.js +32 -23
- package/lib/weapp/ParseObject.js +45 -45
- package/lib/weapp/ParseOp.js +21 -7
- package/lib/weapp/ParseQuery.js +1 -0
- package/lib/weapp/ParseRelation.js +12 -7
- package/lib/weapp/ParseRole.js +2 -0
- package/lib/weapp/ParseSession.js +1 -1
- package/lib/weapp/ParseUser.js +52 -21
- package/lib/weapp/RESTController.js +7 -2
- package/lib/weapp/SingleInstanceStateController.js +2 -4
- package/lib/weapp/Storage.js +1 -2
- package/lib/weapp/StorageController.js +3 -0
- package/lib/weapp/WebSocketController.js +13 -0
- package/lib/weapp/arrayContainsObject.js +4 -3
- package/lib/weapp/canBeSerialized.js +6 -4
- package/lib/weapp/decode.js +8 -5
- package/lib/weapp/encode.js +6 -4
- package/lib/weapp/equals.js +4 -3
- package/lib/weapp/unique.js +3 -2
- package/lib/weapp/unsavedChildren.js +4 -2
- package/lib/weapp/uuid.js +12 -5
- package/package.json +4 -2
|
@@ -634,13 +634,8 @@ var ParseUser = function (_ParseObject) {
|
|
|
634
634
|
if (typeof password !== 'string') {
|
|
635
635
|
return Promise.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
|
|
636
636
|
}
|
|
637
|
-
options = options || {};
|
|
638
|
-
var verificationOption = {};
|
|
639
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
640
|
-
verificationOption.useMasterKey = options.useMasterKey;
|
|
641
|
-
}
|
|
642
637
|
var controller = _CoreManager.default.getUserController();
|
|
643
|
-
return controller.verifyPassword(username, password,
|
|
638
|
+
return controller.verifyPassword(username, password, options || {});
|
|
644
639
|
}
|
|
645
640
|
}, {
|
|
646
641
|
key: "allowCustomUserClass",
|
|
@@ -956,10 +951,13 @@ var DefaultController = {
|
|
|
956
951
|
},
|
|
957
952
|
verifyPassword: function (username, password, options) {
|
|
958
953
|
var RESTController = _CoreManager.default.getRESTController();
|
|
959
|
-
|
|
954
|
+
var data = Object.assign({
|
|
960
955
|
username: username,
|
|
961
956
|
password: password
|
|
962
|
-
}, options
|
|
957
|
+
}, options.ignoreEmailVerification !== undefined && {
|
|
958
|
+
ignoreEmailVerification: options.ignoreEmailVerification
|
|
959
|
+
});
|
|
960
|
+
return RESTController.request('GET', 'verifyPassword', data, options);
|
|
963
961
|
},
|
|
964
962
|
requestEmailVerification: function (email, options) {
|
|
965
963
|
var RESTController = _CoreManager.default.getRESTController();
|
|
@@ -968,6 +966,7 @@ var DefaultController = {
|
|
|
968
966
|
}, options);
|
|
969
967
|
}
|
|
970
968
|
};
|
|
969
|
+
_CoreManager.default.setParseUser(ParseUser);
|
|
971
970
|
_CoreManager.default.setUserController(DefaultController);
|
|
972
971
|
var _default = ParseUser;
|
|
973
972
|
exports.default = _default;
|
|
@@ -72,11 +72,14 @@ var RESTController = {
|
|
|
72
72
|
var response;
|
|
73
73
|
try {
|
|
74
74
|
response = JSON.parse(xhr.responseText);
|
|
75
|
+
var availableHeaders = typeof xhr.getAllResponseHeaders === 'function' ? xhr.getAllResponseHeaders() : "";
|
|
75
76
|
headers = {};
|
|
76
|
-
if (typeof xhr.getResponseHeader === 'function' &&
|
|
77
|
+
if (typeof xhr.getResponseHeader === 'function' && (availableHeaders == null ? void 0 : availableHeaders.indexOf('access-control-expose-headers')) >= 0) {
|
|
77
78
|
var responseHeaders = xhr.getResponseHeader('access-control-expose-headers').split(', ');
|
|
78
79
|
responseHeaders.forEach(function (header) {
|
|
79
|
-
|
|
80
|
+
if (availableHeaders.indexOf(header.toLowerCase()) >= 0) {
|
|
81
|
+
headers[header] = xhr.getResponseHeader(header.toLowerCase());
|
|
82
|
+
}
|
|
80
83
|
});
|
|
81
84
|
}
|
|
82
85
|
} catch (e) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
1
|
Object.defineProperty(exports, "__esModule", {
|
|
3
2
|
value: true
|
|
4
3
|
});
|
|
@@ -20,7 +19,6 @@ exports.removeState = removeState;
|
|
|
20
19
|
exports.setPendingOp = setPendingOp;
|
|
21
20
|
exports.setServerData = setServerData;
|
|
22
21
|
var ObjectStateMutations = _interopRequireWildcard(require("./ObjectStateMutations"));
|
|
23
|
-
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
24
22
|
function _getRequireWildcardCache(nodeInterop) {
|
|
25
23
|
if (typeof WeakMap !== "function") return null;
|
|
26
24
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./StorageController.react-native');
|
|
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.default = arrayContainsObject;
|
|
6
|
-
var
|
|
6
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
7
7
|
function arrayContainsObject(array, object) {
|
|
8
8
|
if (array.indexOf(object) > -1) {
|
|
9
9
|
return true;
|
|
10
10
|
}
|
|
11
|
+
var ParseObject = _CoreManager.default.getParseObject();
|
|
11
12
|
for (var i = 0; i < array.length; i++) {
|
|
12
|
-
if (array[i] instanceof
|
|
13
|
+
if (array[i] instanceof ParseObject && array[i].className === object.className && array[i]._getId() === object._getId()) {
|
|
13
14
|
return true;
|
|
14
15
|
}
|
|
15
16
|
}
|
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.default = canBeSerialized;
|
|
6
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
6
7
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
7
|
-
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
8
8
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
9
9
|
function canBeSerialized(obj) {
|
|
10
|
-
|
|
10
|
+
var ParseObject = _CoreManager.default.getParseObject();
|
|
11
|
+
if (!(obj instanceof ParseObject)) {
|
|
11
12
|
return true;
|
|
12
13
|
}
|
|
13
14
|
var attributes = obj.attributes;
|
|
@@ -26,7 +27,8 @@ function canBeSerializedHelper(value) {
|
|
|
26
27
|
if (value instanceof _ParseRelation.default) {
|
|
27
28
|
return true;
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
+
var ParseObject = _CoreManager.default.getParseObject();
|
|
31
|
+
if (value instanceof ParseObject) {
|
|
30
32
|
return !!value.id;
|
|
31
33
|
}
|
|
32
34
|
if (value instanceof _ParseFile.default) {
|
|
@@ -3,12 +3,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.default = decode;
|
|
6
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
6
7
|
var _ParseACL = _interopRequireDefault(require("./ParseACL"));
|
|
7
8
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
8
9
|
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
9
10
|
var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
|
|
10
|
-
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
11
|
-
var _ParseOp = require("./ParseOp");
|
|
12
11
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
13
12
|
function decode(value) {
|
|
14
13
|
if (value === null || typeof value !== 'object' || value instanceof Date) {
|
|
@@ -22,13 +21,16 @@ function decode(value) {
|
|
|
22
21
|
return dup;
|
|
23
22
|
}
|
|
24
23
|
if (typeof value.__op === 'string') {
|
|
25
|
-
|
|
24
|
+
var _CoreManager$getParse = _CoreManager.default.getParseOp(),
|
|
25
|
+
opFromJSON = _CoreManager$getParse.opFromJSON;
|
|
26
|
+
return opFromJSON(value);
|
|
26
27
|
}
|
|
28
|
+
var ParseObject = _CoreManager.default.getParseObject();
|
|
27
29
|
if (value.__type === 'Pointer' && value.className) {
|
|
28
|
-
return
|
|
30
|
+
return ParseObject.fromJSON(value);
|
|
29
31
|
}
|
|
30
32
|
if (value.__type === 'Object' && value.className) {
|
|
31
|
-
return
|
|
33
|
+
return ParseObject.fromJSON(value);
|
|
32
34
|
}
|
|
33
35
|
if (value.__type === 'Relation') {
|
|
34
36
|
var relation = new _ParseRelation.default(null, null);
|
|
@@ -3,15 +3,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.default = _default;
|
|
6
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
6
7
|
var _ParseACL = _interopRequireDefault(require("./ParseACL"));
|
|
7
8
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
8
9
|
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
9
10
|
var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
|
|
10
|
-
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
11
|
-
var _ParseOp = require("./ParseOp");
|
|
12
11
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
13
12
|
function encode(value, disallowObjects, forcePointers, seen, offline) {
|
|
14
|
-
|
|
13
|
+
var ParseObject = _CoreManager.default.getParseObject();
|
|
14
|
+
if (value instanceof ParseObject) {
|
|
15
15
|
if (disallowObjects) {
|
|
16
16
|
throw new Error('Parse Objects not allowed here');
|
|
17
17
|
}
|
|
@@ -25,7 +25,9 @@ function encode(value, disallowObjects, forcePointers, seen, offline) {
|
|
|
25
25
|
seen = seen.concat(seenEntry);
|
|
26
26
|
return value._toFullJSON(seen, offline);
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
var _CoreManager$getParse = _CoreManager.default.getParseOp(),
|
|
29
|
+
Op = _CoreManager$getParse.Op;
|
|
30
|
+
if (value instanceof Op || value instanceof _ParseACL.default || value instanceof _ParseGeoPoint.default || value instanceof _ParsePolygon.default || value instanceof _ParseRelation.default) {
|
|
29
31
|
return value.toJSON();
|
|
30
32
|
}
|
|
31
33
|
if (value instanceof _ParseFile.default) {
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.default = equals;
|
|
6
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
6
7
|
var _ParseACL = _interopRequireDefault(require("./ParseACL"));
|
|
7
8
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
8
9
|
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
9
|
-
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
10
10
|
function equals(a, b) {
|
|
11
11
|
var toString = Object.prototype.toString;
|
|
12
12
|
if (toString.call(a) === '[object Date]' || toString.call(b) === '[object Date]') {
|
|
@@ -34,10 +34,11 @@ function equals(a, b) {
|
|
|
34
34
|
}
|
|
35
35
|
return true;
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
var ParseObject = _CoreManager.default.getParseObject();
|
|
38
|
+
if (a instanceof _ParseACL.default || a instanceof _ParseFile.default || a instanceof _ParseGeoPoint.default || a instanceof ParseObject) {
|
|
38
39
|
return a.equals(b);
|
|
39
40
|
}
|
|
40
|
-
if (b instanceof
|
|
41
|
+
if (b instanceof ParseObject) {
|
|
41
42
|
if (a.__type === 'Object' || a.__type === 'Pointer') {
|
|
42
43
|
return a.objectId === b.id && a.className === b.className;
|
|
43
44
|
}
|
|
@@ -4,11 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
exports.default = unique;
|
|
6
6
|
var _arrayContainsObject = _interopRequireDefault(require("./arrayContainsObject"));
|
|
7
|
-
var
|
|
7
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
8
8
|
function unique(arr) {
|
|
9
9
|
var uniques = [];
|
|
10
10
|
arr.forEach(function (value) {
|
|
11
|
-
|
|
11
|
+
var ParseObject = _CoreManager.default.getParseObject();
|
|
12
|
+
if (value instanceof ParseObject) {
|
|
12
13
|
if (!(0, _arrayContainsObject.default)(uniques, value)) {
|
|
13
14
|
uniques.push(value);
|
|
14
15
|
}
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.default = unsavedChildren;
|
|
6
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
6
7
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
7
|
-
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
8
8
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
9
9
|
function unsavedChildren(obj, allowDeepUnsaved) {
|
|
10
10
|
var encountered = {
|
|
@@ -28,7 +28,8 @@ function unsavedChildren(obj, allowDeepUnsaved) {
|
|
|
28
28
|
return unsaved.concat(encountered.files);
|
|
29
29
|
}
|
|
30
30
|
function traverse(obj, encountered, shouldThrow, allowDeepUnsaved) {
|
|
31
|
-
|
|
31
|
+
var ParseObject = _CoreManager.default.getParseObject();
|
|
32
|
+
if (obj instanceof ParseObject) {
|
|
32
33
|
if (!obj.id && shouldThrow) {
|
|
33
34
|
throw new Error('Cannot create a pointer to an unsaved Object.');
|
|
34
35
|
}
|
package/lib/react-native/uuid.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _uuid = require("uuid");
|
|
1
6
|
var uuid = null;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
uuid = _uuid.v4;
|
|
8
|
+
module.exports = uuid;
|
|
9
|
+
var _default = uuid;
|
|
10
|
+
exports.default = _default;
|
package/lib/weapp/CoreManager.js
CHANGED
|
@@ -8,176 +8,16 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
10
10
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*/
|
|
14
|
-
/*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
|
|
15
|
-
/*:: import type ParseFile from './ParseFile';*/
|
|
16
|
-
/*:: import type { FileSource } from './ParseFile';*/
|
|
17
|
-
/*:: import type { Op } from './ParseOp';*/
|
|
18
|
-
/*:: import type ParseObject from './ParseObject';*/
|
|
19
|
-
/*:: import type { QueryJSON } from './ParseQuery';*/
|
|
20
|
-
/*:: import type ParseUser from './ParseUser';*/
|
|
21
|
-
/*:: import type { AuthData } from './ParseUser';*/
|
|
22
|
-
/*:: import type { PushData } from './Push';*/
|
|
23
|
-
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
24
|
-
/*:: type AnalyticsController = {
|
|
25
|
-
track: (name: string, dimensions: { [key: string]: string }) => Promise,
|
|
26
|
-
};*/
|
|
27
|
-
/*:: type CloudController = {
|
|
28
|
-
run: (name: string, data: mixed, options: RequestOptions) => Promise,
|
|
29
|
-
getJobsData: (options: RequestOptions) => Promise,
|
|
30
|
-
startJob: (name: string, data: mixed, options: RequestOptions) => Promise,
|
|
31
|
-
};*/
|
|
32
|
-
/*:: type ConfigController = {
|
|
33
|
-
current: () => Promise,
|
|
34
|
-
get: () => Promise,
|
|
35
|
-
save: (attrs: { [key: string]: any }) => Promise,
|
|
36
|
-
};*/
|
|
37
|
-
/*:: type CryptoController = {
|
|
38
|
-
encrypt: (obj: any, secretKey: string) => string,
|
|
39
|
-
decrypt: (encryptedText: string, secretKey: any) => string,
|
|
40
|
-
};*/
|
|
41
|
-
/*:: type FileController = {
|
|
42
|
-
saveFile: (name: string, source: FileSource, options: FullOptions) => Promise,
|
|
43
|
-
saveBase64: (name: string, source: FileSource, options: FullOptions) => Promise,
|
|
44
|
-
download: (uri: string) => Promise,
|
|
45
|
-
};*/
|
|
46
|
-
/*:: type InstallationController = {
|
|
47
|
-
currentInstallationId: () => Promise,
|
|
48
|
-
};*/
|
|
49
|
-
/*:: type ObjectController = {
|
|
50
|
-
fetch: (
|
|
51
|
-
object: ParseObject | Array<ParseObject>,
|
|
52
|
-
forceFetch: boolean,
|
|
53
|
-
options: RequestOptions
|
|
54
|
-
) => Promise,
|
|
55
|
-
save: (object: ParseObject | Array<ParseObject | ParseFile>, options: RequestOptions) => Promise,
|
|
56
|
-
destroy: (object: ParseObject | Array<ParseObject>, options: RequestOptions) => Promise,
|
|
57
|
-
};*/
|
|
58
|
-
/*:: type ObjectStateController = {
|
|
59
|
-
getState: (obj: any) => ?State,
|
|
60
|
-
initializeState: (obj: any, initial?: State) => State,
|
|
61
|
-
removeState: (obj: any) => ?State,
|
|
62
|
-
getServerData: (obj: any) => AttributeMap,
|
|
63
|
-
setServerData: (obj: any, attributes: AttributeMap) => void,
|
|
64
|
-
getPendingOps: (obj: any) => Array<OpsMap>,
|
|
65
|
-
setPendingOp: (obj: any, attr: string, op: ?Op) => void,
|
|
66
|
-
pushPendingState: (obj: any) => void,
|
|
67
|
-
popPendingState: (obj: any) => OpsMap,
|
|
68
|
-
mergeFirstPendingState: (obj: any) => void,
|
|
69
|
-
getObjectCache: (obj: any) => ObjectCache,
|
|
70
|
-
estimateAttribute: (obj: any, attr: string) => mixed,
|
|
71
|
-
estimateAttributes: (obj: any) => AttributeMap,
|
|
72
|
-
commitServerChanges: (obj: any, changes: AttributeMap) => void,
|
|
73
|
-
enqueueTask: (obj: any, task: () => Promise) => Promise,
|
|
74
|
-
clearAllState: () => void,
|
|
75
|
-
duplicateState: (source: any, dest: any) => void,
|
|
76
|
-
};*/
|
|
77
|
-
/*:: type PushController = {
|
|
78
|
-
send: (data: PushData) => Promise,
|
|
79
|
-
};*/
|
|
80
|
-
/*:: type QueryController = {
|
|
81
|
-
find: (className: string, params: QueryJSON, options: RequestOptions) => Promise,
|
|
82
|
-
aggregate: (className: string, params: any, options: RequestOptions) => Promise,
|
|
83
|
-
};*/
|
|
84
|
-
/*:: type RESTController = {
|
|
85
|
-
request: (method: string, path: string, data: mixed, options: RequestOptions) => Promise,
|
|
86
|
-
ajax: (method: string, url: string, data: any, headers?: any, options: FullOptions) => Promise,
|
|
87
|
-
};*/
|
|
88
|
-
/*:: type SchemaController = {
|
|
89
|
-
purge: (className: string) => Promise,
|
|
90
|
-
get: (className: string, options: RequestOptions) => Promise,
|
|
91
|
-
delete: (className: string, options: RequestOptions) => Promise,
|
|
92
|
-
create: (className: string, params: any, options: RequestOptions) => Promise,
|
|
93
|
-
update: (className: string, params: any, options: RequestOptions) => Promise,
|
|
94
|
-
send(className: string, method: string, params: any, options: RequestOptions): Promise,
|
|
95
|
-
};*/
|
|
96
|
-
/*:: type SessionController = {
|
|
97
|
-
getSession: (token: RequestOptions) => Promise,
|
|
98
|
-
};*/
|
|
99
|
-
/*:: type StorageController =
|
|
100
|
-
| {
|
|
101
|
-
async: 0,
|
|
102
|
-
getItem: (path: string) => ?string,
|
|
103
|
-
setItem: (path: string, value: string) => void,
|
|
104
|
-
removeItem: (path: string) => void,
|
|
105
|
-
getItemAsync?: (path: string) => Promise,
|
|
106
|
-
setItemAsync?: (path: string, value: string) => Promise,
|
|
107
|
-
removeItemAsync?: (path: string) => Promise,
|
|
108
|
-
clear: () => void,
|
|
109
|
-
}
|
|
110
|
-
| {
|
|
111
|
-
async: 1,
|
|
112
|
-
getItem?: (path: string) => ?string,
|
|
113
|
-
setItem?: (path: string, value: string) => void,
|
|
114
|
-
removeItem?: (path: string) => void,
|
|
115
|
-
getItemAsync: (path: string) => Promise,
|
|
116
|
-
setItemAsync: (path: string, value: string) => Promise,
|
|
117
|
-
removeItemAsync: (path: string) => Promise,
|
|
118
|
-
clear: () => void,
|
|
119
|
-
};*/
|
|
120
|
-
/*:: type LocalDatastoreController = {
|
|
121
|
-
fromPinWithName: (name: string) => ?any,
|
|
122
|
-
pinWithName: (name: string, objects: any) => void,
|
|
123
|
-
unPinWithName: (name: string) => void,
|
|
124
|
-
getAllContents: () => ?any,
|
|
125
|
-
clear: () => void,
|
|
126
|
-
};*/
|
|
127
|
-
/*:: type UserController = {
|
|
128
|
-
setCurrentUser: (user: ParseUser) => Promise,
|
|
129
|
-
currentUser: () => ?ParseUser,
|
|
130
|
-
currentUserAsync: () => Promise,
|
|
131
|
-
signUp: (user: ParseUser, attrs: AttributeMap, options: RequestOptions) => Promise,
|
|
132
|
-
logIn: (user: ParseUser, options: RequestOptions) => Promise,
|
|
133
|
-
become: (options: RequestOptions) => Promise,
|
|
134
|
-
hydrate: (userJSON: AttributeMap) => Promise,
|
|
135
|
-
logOut: (options: RequestOptions) => Promise,
|
|
136
|
-
me: (options: RequestOptions) => Promise,
|
|
137
|
-
requestPasswordReset: (email: string, options: RequestOptions) => Promise,
|
|
138
|
-
updateUserOnDisk: (user: ParseUser) => Promise,
|
|
139
|
-
upgradeToRevocableSession: (user: ParseUser, options: RequestOptions) => Promise,
|
|
140
|
-
linkWith: (user: ParseUser, authData: AuthData) => Promise,
|
|
141
|
-
removeUserFromDisk: () => Promise,
|
|
142
|
-
verifyPassword: (username: string, password: string, options: RequestOptions) => Promise,
|
|
143
|
-
requestEmailVerification: (email: string, options: RequestOptions) => Promise,
|
|
144
|
-
};*/
|
|
145
|
-
/*:: type HooksController = {
|
|
146
|
-
get: (type: string, functionName?: string, triggerName?: string) => Promise,
|
|
147
|
-
create: (hook: mixed) => Promise,
|
|
148
|
-
delete: (hook: mixed) => Promise,
|
|
149
|
-
update: (hook: mixed) => Promise,
|
|
150
|
-
send: (method: string, path: string, body?: mixed) => Promise,
|
|
151
|
-
};*/
|
|
152
|
-
/*:: type WebSocketController = {
|
|
11
|
+
/** Based on https://github.com/react-native-async-storage/async-storage/blob/main/packages/default-storage-backend/src/types.ts */
|
|
12
|
+
/*:: export type WebSocketController = {
|
|
153
13
|
onopen: () => void,
|
|
154
14
|
onmessage: (message: any) => void,
|
|
155
|
-
onclose: () => void,
|
|
15
|
+
onclose: (arg?: any) => void,
|
|
156
16
|
onerror: (error: any) => void,
|
|
157
17
|
send: (data: any) => void,
|
|
158
18
|
close: () => void,
|
|
159
19
|
};*/
|
|
160
|
-
|
|
161
|
-
AnalyticsController?: AnalyticsController,
|
|
162
|
-
CloudController?: CloudController,
|
|
163
|
-
ConfigController?: ConfigController,
|
|
164
|
-
FileController?: FileController,
|
|
165
|
-
InstallationController?: InstallationController,
|
|
166
|
-
ObjectController?: ObjectController,
|
|
167
|
-
ObjectStateController?: ObjectStateController,
|
|
168
|
-
PushController?: PushController,
|
|
169
|
-
QueryController?: QueryController,
|
|
170
|
-
RESTController?: RESTController,
|
|
171
|
-
SchemaController?: SchemaController,
|
|
172
|
-
SessionController?: SessionController,
|
|
173
|
-
StorageController?: StorageController,
|
|
174
|
-
LocalDatastoreController?: LocalDatastoreController,
|
|
175
|
-
UserController?: UserController,
|
|
176
|
-
HooksController?: HooksController,
|
|
177
|
-
WebSocketController?: WebSocketController,
|
|
178
|
-
};*/
|
|
179
|
-
var config /*: Config & { [key: string]: mixed }*/ = {
|
|
180
|
-
// Defaults
|
|
20
|
+
var config /*: Config & { [key: string]: any }*/ = {
|
|
181
21
|
IS_NODE: typeof process !== 'undefined' && !!process.versions && !!process.versions.node && !process.versions.electron,
|
|
182
22
|
REQUEST_ATTEMPT_LIMIT: 5,
|
|
183
23
|
REQUEST_BATCH_SIZE: 20,
|
|
@@ -187,7 +27,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
|
|
|
187
27
|
SERVER_AUTH_TOKEN: null,
|
|
188
28
|
LIVEQUERY_SERVER_URL: null,
|
|
189
29
|
ENCRYPTED_KEY: null,
|
|
190
|
-
VERSION: 'js' + "5.0.
|
|
30
|
+
VERSION: 'js' + "5.1.0-alpha.10",
|
|
191
31
|
APPLICATION_ID: null,
|
|
192
32
|
JAVASCRIPT_KEY: null,
|
|
193
33
|
MASTER_KEY: null,
|
|
@@ -261,11 +101,18 @@ var CoreManager = {
|
|
|
261
101
|
requireMethods('FileController', ['saveFile', 'saveBase64'], controller);
|
|
262
102
|
config['FileController'] = controller;
|
|
263
103
|
},
|
|
104
|
+
setEventuallyQueue: function (controller /*: EventuallyQueue*/) {
|
|
105
|
+
requireMethods('EventuallyQueue', ['poll', 'save', 'destroy'], controller);
|
|
106
|
+
config['EventuallyQueue'] = controller;
|
|
107
|
+
},
|
|
108
|
+
getEventuallyQueue: function () /*: EventuallyQueue*/{
|
|
109
|
+
return config['EventuallyQueue'];
|
|
110
|
+
},
|
|
264
111
|
getFileController: function () /*: FileController*/{
|
|
265
112
|
return config['FileController'];
|
|
266
113
|
},
|
|
267
114
|
setInstallationController: function (controller /*: InstallationController*/) {
|
|
268
|
-
requireMethods('InstallationController', ['currentInstallationId'], controller);
|
|
115
|
+
requireMethods('InstallationController', ['currentInstallationId', 'currentInstallation', 'updateInstallationOnDisk'], controller);
|
|
269
116
|
config['InstallationController'] = controller;
|
|
270
117
|
},
|
|
271
118
|
getInstallationController: function () /*: InstallationController*/{
|
|
@@ -350,16 +197,16 @@ var CoreManager = {
|
|
|
350
197
|
getStorageController: function () /*: StorageController*/{
|
|
351
198
|
return config['StorageController'];
|
|
352
199
|
},
|
|
353
|
-
setAsyncStorage: function (storage /*:
|
|
200
|
+
setAsyncStorage: function (storage /*: AsyncStorageType*/) {
|
|
354
201
|
config['AsyncStorage'] = storage;
|
|
355
202
|
},
|
|
356
203
|
getAsyncStorage: function () {
|
|
357
204
|
return config['AsyncStorage'];
|
|
358
205
|
},
|
|
359
|
-
setWebSocketController: function (controller /*: WebSocketController*/) {
|
|
206
|
+
setWebSocketController: function (controller /*: new (url: string | URL, protocols?: string | string[] | undefined) => WebSocketController*/) {
|
|
360
207
|
config['WebSocketController'] = controller;
|
|
361
208
|
},
|
|
362
|
-
getWebSocketController: function () /*: WebSocketController*/{
|
|
209
|
+
getWebSocketController: function () /*: new (url: string | URL, protocols?: string | string[] | undefined) => WebSocketController*/{
|
|
363
210
|
return config['WebSocketController'];
|
|
364
211
|
},
|
|
365
212
|
setUserController: function (controller /*: UserController*/) {
|
|
@@ -369,11 +216,11 @@ var CoreManager = {
|
|
|
369
216
|
getUserController: function () /*: UserController*/{
|
|
370
217
|
return config['UserController'];
|
|
371
218
|
},
|
|
372
|
-
setLiveQueryController: function (controller /*:
|
|
219
|
+
setLiveQueryController: function (controller /*: LiveQueryControllerType*/) {
|
|
373
220
|
requireMethods('LiveQueryController', ['setDefaultLiveQueryClient', 'getDefaultLiveQueryClient', '_clearCachedDefaultClient'], controller);
|
|
374
221
|
config['LiveQueryController'] = controller;
|
|
375
222
|
},
|
|
376
|
-
getLiveQueryController: function () /*:
|
|
223
|
+
getLiveQueryController: function () /*: LiveQueryControllerType*/{
|
|
377
224
|
return config['LiveQueryController'];
|
|
378
225
|
},
|
|
379
226
|
setHooksController: function (controller /*: HooksController*/) {
|
|
@@ -382,6 +229,36 @@ var CoreManager = {
|
|
|
382
229
|
},
|
|
383
230
|
getHooksController: function () /*: HooksController*/{
|
|
384
231
|
return config['HooksController'];
|
|
232
|
+
},
|
|
233
|
+
setParseOp: function (op /*: ParseOp*/) {
|
|
234
|
+
config['ParseOp'] = op;
|
|
235
|
+
},
|
|
236
|
+
getParseOp: function () {
|
|
237
|
+
return config['ParseOp'];
|
|
238
|
+
},
|
|
239
|
+
setParseObject: function (object /*: ParseObject*/) {
|
|
240
|
+
config['ParseObject'] = object;
|
|
241
|
+
},
|
|
242
|
+
getParseObject: function () /*: ParseObject*/{
|
|
243
|
+
return config['ParseObject'];
|
|
244
|
+
},
|
|
245
|
+
setParseQuery: function (query /*: ParseQuery*/) {
|
|
246
|
+
config['ParseQuery'] = query;
|
|
247
|
+
},
|
|
248
|
+
getParseQuery: function () {
|
|
249
|
+
return config['ParseQuery'];
|
|
250
|
+
},
|
|
251
|
+
setParseRole: function (role /*: ParseRole*/) {
|
|
252
|
+
config['ParseRole'] = role;
|
|
253
|
+
},
|
|
254
|
+
getParseRole: function () /*: ParseRole*/{
|
|
255
|
+
return config['ParseRole'];
|
|
256
|
+
},
|
|
257
|
+
setParseUser: function (user /*: ParseUser*/) {
|
|
258
|
+
config['ParseUser'] = user;
|
|
259
|
+
},
|
|
260
|
+
getParseUser: function () /*: ParseUser*/{
|
|
261
|
+
return config['ParseUser'];
|
|
385
262
|
}
|
|
386
263
|
};
|
|
387
264
|
module.exports = CoreManager;
|