parse 5.2.0-alpha.1 → 5.2.0-alpha.2
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/dist/parse.js +10102 -15029
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +10093 -15165
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Analytics.js +7 -11
- package/lib/browser/AnonymousUtils.js +17 -22
- package/lib/browser/Cloud.js +23 -41
- package/lib/browser/CoreManager.js +71 -79
- package/lib/browser/CryptoController.js +14 -9
- package/lib/browser/EventEmitter.js +9 -2
- package/lib/browser/EventuallyQueue.js +156 -357
- package/lib/browser/FacebookUtils.js +23 -28
- package/lib/browser/IndexedDBStorageController.js +18 -14
- package/lib/browser/InstallationController.js +55 -121
- package/lib/browser/LiveQueryClient.js +308 -484
- package/lib/browser/LiveQuerySubscription.js +25 -28
- package/lib/browser/LocalDatastore.js +258 -624
- package/lib/browser/LocalDatastoreController.default.js +42 -226
- package/lib/browser/LocalDatastoreController.js +11 -1
- package/lib/browser/LocalDatastoreController.react-native.js +66 -160
- package/lib/browser/LocalDatastoreUtils.js +4 -7
- package/lib/browser/ObjectStateMutations.js +54 -96
- package/lib/browser/OfflineQuery.js +106 -198
- package/lib/browser/Parse.js +44 -60
- package/lib/browser/ParseACL.js +242 -288
- package/lib/browser/ParseCLP.js +372 -572
- package/lib/browser/ParseConfig.js +115 -138
- package/lib/browser/ParseError.js +85 -182
- package/lib/browser/ParseFile.js +294 -438
- package/lib/browser/ParseGeoPoint.js +121 -146
- package/lib/browser/ParseHooks.js +23 -25
- package/lib/browser/ParseInstallation.js +225 -367
- package/lib/browser/ParseLiveQuery.js +74 -148
- package/lib/browser/ParseObject.js +2014 -2621
- package/lib/browser/ParseOp.js +343 -484
- package/lib/browser/ParsePolygon.js +101 -120
- package/lib/browser/ParseQuery.js +1708 -2052
- package/lib/browser/ParseRelation.js +99 -118
- package/lib/browser/ParseRole.js +88 -140
- package/lib/browser/ParseSchema.js +372 -434
- package/lib/browser/ParseSession.js +62 -110
- package/lib/browser/ParseUser.js +941 -1284
- package/lib/browser/Push.js +15 -38
- package/lib/browser/RESTController.js +85 -124
- package/lib/browser/SingleInstanceStateController.js +57 -86
- package/lib/browser/Socket.weapp.js +50 -33
- package/lib/browser/Storage.js +23 -28
- package/lib/browser/StorageController.browser.js +16 -13
- package/lib/browser/StorageController.default.js +15 -14
- package/lib/browser/StorageController.js +14 -1
- package/lib/browser/StorageController.react-native.js +31 -30
- package/lib/browser/StorageController.weapp.js +19 -13
- package/lib/browser/TaskQueue.js +31 -43
- package/lib/browser/UniqueInstanceStateController.js +65 -86
- package/lib/browser/WebSocketController.js +11 -4
- package/lib/browser/Xhr.weapp.js +90 -78
- package/lib/browser/arrayContainsObject.js +3 -3
- package/lib/browser/canBeSerialized.js +10 -11
- package/lib/browser/decode.js +11 -11
- package/lib/browser/encode.js +11 -11
- package/lib/browser/equals.js +9 -10
- package/lib/browser/escape.js +2 -2
- package/lib/browser/isRevocableSession.js +1 -1
- package/lib/browser/parseDate.js +10 -10
- package/lib/browser/promiseUtils.js +19 -19
- package/lib/browser/unique.js +4 -4
- package/lib/browser/unsavedChildren.js +20 -21
- package/lib/browser/uuid.js +2 -4
- package/lib/node/Analytics.js +2 -6
- package/lib/node/AnonymousUtils.js +7 -12
- package/lib/node/Cloud.js +8 -8
- package/lib/node/CoreManager.js +59 -67
- package/lib/node/CryptoController.js +8 -3
- package/lib/node/EventEmitter.js +7 -1
- package/lib/node/EventuallyQueue.js +17 -36
- package/lib/node/FacebookUtils.js +1 -5
- package/lib/node/IndexedDBStorageController.js +14 -10
- package/lib/node/InstallationController.js +9 -10
- package/lib/node/LiveQueryClient.js +12 -14
- package/lib/node/LiveQuerySubscription.js +3 -4
- package/lib/node/LocalDatastore.js +20 -20
- package/lib/node/LocalDatastoreController.default.js +8 -9
- package/lib/node/LocalDatastoreController.js +14 -1
- package/lib/node/LocalDatastoreController.react-native.js +25 -21
- package/lib/node/LocalDatastoreUtils.js +4 -7
- package/lib/node/ObjectStateMutations.js +9 -19
- package/lib/node/OfflineQuery.js +37 -23
- package/lib/node/Parse.js +33 -47
- package/lib/node/ParseACL.js +18 -27
- package/lib/node/ParseCLP.js +35 -37
- package/lib/node/ParseConfig.js +7 -14
- package/lib/node/ParseError.js +457 -458
- package/lib/node/ParseFile.js +24 -44
- package/lib/node/ParseGeoPoint.js +16 -17
- package/lib/node/ParseHooks.js +13 -15
- package/lib/node/ParseInstallation.js +7 -8
- package/lib/node/ParseLiveQuery.js +6 -11
- package/lib/node/ParseObject.js +139 -170
- package/lib/node/ParseOp.js +32 -44
- package/lib/node/ParsePolygon.js +11 -17
- package/lib/node/ParseQuery.js +97 -120
- package/lib/node/ParseRelation.js +7 -16
- package/lib/node/ParseRole.js +7 -8
- package/lib/node/ParseSchema.js +26 -39
- package/lib/node/ParseSession.js +7 -8
- package/lib/node/ParseUser.js +73 -84
- package/lib/node/Push.js +4 -9
- package/lib/node/RESTController.js +21 -33
- package/lib/node/SingleInstanceStateController.js +41 -69
- package/lib/node/Socket.weapp.js +23 -2
- package/lib/node/Storage.js +11 -16
- package/lib/node/StorageController.browser.js +10 -8
- package/lib/node/StorageController.default.js +9 -9
- package/lib/node/StorageController.js +16 -1
- package/lib/node/StorageController.react-native.js +17 -17
- package/lib/node/StorageController.weapp.js +14 -8
- package/lib/node/TaskQueue.js +2 -3
- package/lib/node/UniqueInstanceStateController.js +40 -60
- package/lib/node/WebSocketController.js +15 -2
- package/lib/node/Xhr.weapp.js +11 -2
- package/lib/node/arrayContainsObject.js +1 -1
- package/lib/node/canBeSerialized.js +2 -2
- package/lib/node/decode.js +1 -1
- package/lib/node/encode.js +2 -2
- package/lib/node/equals.js +1 -1
- package/lib/node/escape.js +1 -1
- package/lib/node/isRevocableSession.js +1 -1
- package/lib/node/parseDate.js +1 -1
- package/lib/node/promiseUtils.js +7 -7
- package/lib/node/unique.js +2 -2
- package/lib/node/unsavedChildren.js +2 -2
- package/lib/node/uuid.js +2 -4
- package/lib/react-native/Analytics.js +2 -2
- package/lib/react-native/AnonymousUtils.js +3 -4
- package/lib/react-native/CoreManager.js +2 -3
- package/lib/react-native/CryptoController.js +6 -1
- package/lib/react-native/EventEmitter.js +6 -1
- package/lib/react-native/EventuallyQueue.js +1 -2
- package/lib/react-native/FacebookUtils.js +1 -2
- package/lib/react-native/IndexedDBStorageController.js +11 -5
- package/lib/react-native/InstallationController.js +1 -2
- package/lib/react-native/LiveQueryClient.js +2 -4
- package/lib/react-native/LiveQuerySubscription.js +2 -4
- package/lib/react-native/LocalDatastore.js +3 -3
- package/lib/react-native/LocalDatastoreController.default.js +1 -2
- package/lib/react-native/LocalDatastoreController.js +11 -1
- package/lib/react-native/LocalDatastoreController.react-native.js +11 -12
- package/lib/react-native/LocalDatastoreUtils.js +3 -6
- package/lib/react-native/OfflineQuery.js +25 -20
- package/lib/react-native/Parse.js +24 -38
- package/lib/react-native/ParseACL.js +4 -6
- package/lib/react-native/ParseCLP.js +2 -4
- package/lib/react-native/ParseConfig.js +4 -6
- package/lib/react-native/ParseError.js +13 -31
- package/lib/react-native/ParseFile.js +3 -4
- package/lib/react-native/ParseGeoPoint.js +2 -4
- package/lib/react-native/ParseInstallation.js +13 -30
- package/lib/react-native/ParseLiveQuery.js +2 -4
- package/lib/react-native/ParseObject.js +77 -87
- package/lib/react-native/ParseOp.js +41 -79
- package/lib/react-native/ParsePolygon.js +2 -4
- package/lib/react-native/ParseQuery.js +43 -45
- package/lib/react-native/ParseRelation.js +2 -4
- package/lib/react-native/ParseRole.js +13 -30
- package/lib/react-native/ParseSchema.js +3 -5
- package/lib/react-native/ParseSession.js +12 -29
- package/lib/react-native/ParseUser.js +24 -49
- package/lib/react-native/RESTController.js +10 -4
- package/lib/react-native/SingleInstanceStateController.js +23 -37
- package/lib/react-native/Socket.weapp.js +9 -4
- package/lib/react-native/Storage.js +1 -2
- package/lib/react-native/StorageController.browser.js +6 -1
- package/lib/react-native/StorageController.default.js +6 -1
- package/lib/react-native/StorageController.js +13 -1
- package/lib/react-native/StorageController.react-native.js +11 -6
- package/lib/react-native/StorageController.weapp.js +6 -1
- package/lib/react-native/TaskQueue.js +2 -4
- package/lib/react-native/UniqueInstanceStateController.js +23 -37
- package/lib/react-native/WebSocketController.js +9 -1
- package/lib/react-native/Xhr.weapp.js +9 -4
- package/lib/react-native/unsavedChildren.js +3 -3
- package/lib/react-native/uuid.js +1 -2
- package/lib/weapp/Analytics.js +7 -11
- package/lib/weapp/AnonymousUtils.js +17 -22
- package/lib/weapp/Cloud.js +23 -41
- package/lib/weapp/CoreManager.js +71 -79
- package/lib/weapp/CryptoController.js +14 -9
- package/lib/weapp/EventEmitter.js +9 -2
- package/lib/weapp/EventuallyQueue.js +156 -357
- package/lib/weapp/FacebookUtils.js +23 -28
- package/lib/weapp/IndexedDBStorageController.js +18 -14
- package/lib/weapp/InstallationController.js +55 -121
- package/lib/weapp/LiveQueryClient.js +308 -484
- package/lib/weapp/LiveQuerySubscription.js +25 -28
- package/lib/weapp/LocalDatastore.js +258 -624
- package/lib/weapp/LocalDatastoreController.default.js +42 -226
- package/lib/weapp/LocalDatastoreController.js +11 -1
- package/lib/weapp/LocalDatastoreController.react-native.js +66 -160
- package/lib/weapp/LocalDatastoreUtils.js +4 -7
- package/lib/weapp/ObjectStateMutations.js +54 -96
- package/lib/weapp/OfflineQuery.js +106 -198
- package/lib/weapp/Parse.js +44 -59
- package/lib/weapp/ParseACL.js +242 -288
- package/lib/weapp/ParseCLP.js +372 -572
- package/lib/weapp/ParseConfig.js +115 -138
- package/lib/weapp/ParseError.js +85 -182
- package/lib/weapp/ParseFile.js +295 -440
- package/lib/weapp/ParseGeoPoint.js +121 -146
- package/lib/weapp/ParseHooks.js +23 -25
- package/lib/weapp/ParseInstallation.js +225 -367
- package/lib/weapp/ParseLiveQuery.js +74 -148
- package/lib/weapp/ParseObject.js +2014 -2621
- package/lib/weapp/ParseOp.js +343 -484
- package/lib/weapp/ParsePolygon.js +101 -120
- package/lib/weapp/ParseQuery.js +1708 -2052
- package/lib/weapp/ParseRelation.js +99 -118
- package/lib/weapp/ParseRole.js +88 -140
- package/lib/weapp/ParseSchema.js +372 -434
- package/lib/weapp/ParseSession.js +62 -110
- package/lib/weapp/ParseUser.js +941 -1284
- package/lib/weapp/Push.js +15 -38
- package/lib/weapp/RESTController.js +86 -125
- package/lib/weapp/SingleInstanceStateController.js +57 -86
- package/lib/weapp/Socket.weapp.js +50 -33
- package/lib/weapp/Storage.js +23 -28
- package/lib/weapp/StorageController.browser.js +16 -13
- package/lib/weapp/StorageController.default.js +15 -14
- package/lib/weapp/StorageController.js +14 -1
- package/lib/weapp/StorageController.react-native.js +31 -30
- package/lib/weapp/StorageController.weapp.js +19 -13
- package/lib/weapp/TaskQueue.js +31 -43
- package/lib/weapp/UniqueInstanceStateController.js +65 -86
- package/lib/weapp/WebSocketController.js +11 -4
- package/lib/weapp/Xhr.weapp.js +90 -78
- package/lib/weapp/arrayContainsObject.js +3 -3
- package/lib/weapp/canBeSerialized.js +10 -11
- package/lib/weapp/decode.js +11 -11
- package/lib/weapp/encode.js +11 -11
- package/lib/weapp/equals.js +9 -10
- package/lib/weapp/escape.js +2 -2
- package/lib/weapp/isRevocableSession.js +1 -1
- package/lib/weapp/parseDate.js +10 -10
- package/lib/weapp/promiseUtils.js +19 -19
- package/lib/weapp/unique.js +4 -4
- package/lib/weapp/unsavedChildren.js +20 -21
- package/lib/weapp/uuid.js +6 -8
- package/package.json +19 -25
package/lib/browser/decode.js
CHANGED
|
@@ -8,29 +8,29 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = decode;
|
|
9
9
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
10
10
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
11
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
12
11
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
13
12
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
14
13
|
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
15
14
|
var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
|
|
16
15
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
17
|
-
function decode(value
|
|
18
|
-
if (value === null ||
|
|
16
|
+
function decode(value) {
|
|
17
|
+
if (value === null || typeof value !== 'object' || value instanceof Date) {
|
|
19
18
|
return value;
|
|
20
19
|
}
|
|
21
20
|
if ((0, _isArray.default)(value)) {
|
|
22
|
-
|
|
23
|
-
(0, _forEach.default)(value).call(value,
|
|
21
|
+
const dup = [];
|
|
22
|
+
(0, _forEach.default)(value).call(value, (v, i) => {
|
|
24
23
|
dup[i] = decode(v);
|
|
25
24
|
});
|
|
26
25
|
return dup;
|
|
27
26
|
}
|
|
28
27
|
if (typeof value.__op === 'string') {
|
|
29
|
-
|
|
30
|
-
opFromJSON
|
|
28
|
+
const {
|
|
29
|
+
opFromJSON
|
|
30
|
+
} = _CoreManager.default.getParseOp();
|
|
31
31
|
return opFromJSON(value);
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
const ParseObject = _CoreManager.default.getParseObject();
|
|
34
34
|
if (value.__type === 'Pointer' && value.className) {
|
|
35
35
|
return ParseObject.fromJSON(value);
|
|
36
36
|
}
|
|
@@ -39,7 +39,7 @@ function decode(value /*: any*/) /*: any*/{
|
|
|
39
39
|
}
|
|
40
40
|
if (value.__type === 'Relation') {
|
|
41
41
|
// The parent and key fields will be populated by the parent
|
|
42
|
-
|
|
42
|
+
const relation = new _ParseRelation.default(null, null);
|
|
43
43
|
relation.targetClassName = value.className;
|
|
44
44
|
return relation;
|
|
45
45
|
}
|
|
@@ -58,8 +58,8 @@ function decode(value /*: any*/) /*: any*/{
|
|
|
58
58
|
if (value.__type === 'Polygon') {
|
|
59
59
|
return new _ParsePolygon.default(value.coordinates);
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
for (
|
|
61
|
+
const copy = {};
|
|
62
|
+
for (const k in value) {
|
|
63
63
|
copy[k] = decode(value[k]);
|
|
64
64
|
}
|
|
65
65
|
return copy;
|
package/lib/browser/encode.js
CHANGED
|
@@ -6,7 +6,6 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = _default;
|
|
9
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
10
9
|
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
11
10
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
12
11
|
var _startsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/starts-with"));
|
|
@@ -19,13 +18,13 @@ var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
|
19
18
|
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
20
19
|
var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
|
|
21
20
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
22
|
-
function encode(value
|
|
23
|
-
|
|
21
|
+
function encode(value, disallowObjects, forcePointers, seen, offline) {
|
|
22
|
+
const ParseObject = _CoreManager.default.getParseObject();
|
|
24
23
|
if (value instanceof ParseObject) {
|
|
25
24
|
if (disallowObjects) {
|
|
26
25
|
throw new Error('Parse Objects not allowed here');
|
|
27
26
|
}
|
|
28
|
-
|
|
27
|
+
const seenEntry = value.id ? value.className + ':' + value.id : value;
|
|
29
28
|
if (forcePointers || !seen || (0, _indexOf.default)(seen).call(seen, seenEntry) > -1 || value.dirty() || (0, _keys.default)(value._getServerData()).length < 1) {
|
|
30
29
|
var _context;
|
|
31
30
|
if (offline && (0, _startsWith.default)(_context = value._getId()).call(_context, 'local')) {
|
|
@@ -36,8 +35,9 @@ function encode(value /*: any*/, disallowObjects /*: boolean*/, forcePointers /*
|
|
|
36
35
|
seen = (0, _concat.default)(seen).call(seen, seenEntry);
|
|
37
36
|
return value._toFullJSON(seen, offline);
|
|
38
37
|
}
|
|
39
|
-
|
|
40
|
-
Op
|
|
38
|
+
const {
|
|
39
|
+
Op
|
|
40
|
+
} = _CoreManager.default.getParseOp();
|
|
41
41
|
if (value instanceof Op || value instanceof _ParseACL.default || value instanceof _ParseGeoPoint.default || value instanceof _ParsePolygon.default || value instanceof _ParseRelation.default) {
|
|
42
42
|
return value.toJSON();
|
|
43
43
|
}
|
|
@@ -60,19 +60,19 @@ function encode(value /*: any*/, disallowObjects /*: boolean*/, forcePointers /*
|
|
|
60
60
|
return value.source;
|
|
61
61
|
}
|
|
62
62
|
if ((0, _isArray.default)(value)) {
|
|
63
|
-
return (0, _map.default)(value).call(value,
|
|
63
|
+
return (0, _map.default)(value).call(value, v => {
|
|
64
64
|
return encode(v, disallowObjects, forcePointers, seen, offline);
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
if (value &&
|
|
68
|
-
|
|
69
|
-
for (
|
|
67
|
+
if (value && typeof value === 'object') {
|
|
68
|
+
const output = {};
|
|
69
|
+
for (const k in value) {
|
|
70
70
|
output[k] = encode(value[k], disallowObjects, forcePointers, seen, offline);
|
|
71
71
|
}
|
|
72
72
|
return output;
|
|
73
73
|
}
|
|
74
74
|
return value;
|
|
75
75
|
}
|
|
76
|
-
function _default(value
|
|
76
|
+
function _default(value, disallowObjects, forcePointers, seen, offline) {
|
|
77
77
|
return encode(value, !!disallowObjects, !!forcePointers, seen || [], offline);
|
|
78
78
|
}
|
package/lib/browser/equals.js
CHANGED
|
@@ -8,22 +8,21 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = equals;
|
|
9
9
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
10
10
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
11
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
12
11
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
13
12
|
var _ParseACL = _interopRequireDefault(require("./ParseACL"));
|
|
14
13
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
15
14
|
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
16
|
-
function equals(a
|
|
17
|
-
|
|
15
|
+
function equals(a, b) {
|
|
16
|
+
const toString = Object.prototype.toString;
|
|
18
17
|
if (toString.call(a) === '[object Date]' || toString.call(b) === '[object Date]') {
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const dateA = new Date(a);
|
|
19
|
+
const dateB = new Date(b);
|
|
21
20
|
return +dateA === +dateB;
|
|
22
21
|
}
|
|
23
|
-
if (
|
|
22
|
+
if (typeof a !== typeof b) {
|
|
24
23
|
return false;
|
|
25
24
|
}
|
|
26
|
-
if (!a ||
|
|
25
|
+
if (!a || typeof a !== 'object') {
|
|
27
26
|
// a is a primitive
|
|
28
27
|
return a === b;
|
|
29
28
|
}
|
|
@@ -34,14 +33,14 @@ function equals(a /*: any*/, b /*: any*/) /*: boolean*/{
|
|
|
34
33
|
if (a.length !== b.length) {
|
|
35
34
|
return false;
|
|
36
35
|
}
|
|
37
|
-
for (
|
|
36
|
+
for (let i = a.length; i--;) {
|
|
38
37
|
if (!equals(a[i], b[i])) {
|
|
39
38
|
return false;
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
return true;
|
|
43
42
|
}
|
|
44
|
-
|
|
43
|
+
const ParseObject = _CoreManager.default.getParseObject();
|
|
45
44
|
if (a instanceof _ParseACL.default || a instanceof _ParseFile.default || a instanceof _ParseGeoPoint.default || a instanceof ParseObject) {
|
|
46
45
|
return a.equals(b);
|
|
47
46
|
}
|
|
@@ -53,7 +52,7 @@ function equals(a /*: any*/, b /*: any*/) /*: boolean*/{
|
|
|
53
52
|
if ((0, _keys.default)(a).length !== (0, _keys.default)(b).length) {
|
|
54
53
|
return false;
|
|
55
54
|
}
|
|
56
|
-
for (
|
|
55
|
+
for (const k in a) {
|
|
57
56
|
if (!equals(a[k], b[k])) {
|
|
58
57
|
return false;
|
|
59
58
|
}
|
package/lib/browser/escape.js
CHANGED
|
@@ -5,7 +5,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = escape;
|
|
8
|
-
|
|
8
|
+
const encoded = {
|
|
9
9
|
'&': '&',
|
|
10
10
|
'<': '<',
|
|
11
11
|
'>': '>',
|
|
@@ -13,7 +13,7 @@ var encoded = {
|
|
|
13
13
|
"'": ''',
|
|
14
14
|
'"': '"'
|
|
15
15
|
};
|
|
16
|
-
function escape(str
|
|
16
|
+
function escape(str) {
|
|
17
17
|
return str.replace(/[&<>\/'"]/g, function (char) {
|
|
18
18
|
return encoded[char];
|
|
19
19
|
});
|
|
@@ -7,6 +7,6 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = isRevocableSession;
|
|
9
9
|
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
10
|
-
function isRevocableSession(token
|
|
10
|
+
function isRevocableSession(token) {
|
|
11
11
|
return (0, _indexOf.default)(token).call(token, 'r:') > -1;
|
|
12
12
|
}
|
package/lib/browser/parseDate.js
CHANGED
|
@@ -7,18 +7,18 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = parseDate;
|
|
9
9
|
var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-int"));
|
|
10
|
-
function parseDate(iso8601
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
function parseDate(iso8601) {
|
|
11
|
+
const regexp = new RegExp('^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2})' + 'T' + '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})' + '(.([0-9]+))?' + 'Z$');
|
|
12
|
+
const match = regexp.exec(iso8601);
|
|
13
13
|
if (!match) {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const year = (0, _parseInt2.default)(match[1]) || 0;
|
|
17
|
+
const month = ((0, _parseInt2.default)(match[2]) || 1) - 1;
|
|
18
|
+
const day = (0, _parseInt2.default)(match[3]) || 0;
|
|
19
|
+
const hour = (0, _parseInt2.default)(match[4]) || 0;
|
|
20
|
+
const minute = (0, _parseInt2.default)(match[5]) || 0;
|
|
21
|
+
const second = (0, _parseInt2.default)(match[6]) || 0;
|
|
22
|
+
const milli = (0, _parseInt2.default)(match[8]) || 0;
|
|
23
23
|
return new Date(Date.UTC(year, month, day, hour, minute, second, milli));
|
|
24
24
|
}
|
|
@@ -11,38 +11,38 @@ exports.when = when;
|
|
|
11
11
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
12
12
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
13
13
|
// Create Deferred Promise
|
|
14
|
-
function resolvingPromise
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
function resolvingPromise() {
|
|
15
|
+
let res;
|
|
16
|
+
let rej;
|
|
17
|
+
const promise = new _promise.default((resolve, reject) => {
|
|
18
18
|
res = resolve;
|
|
19
19
|
rej = reject;
|
|
20
20
|
});
|
|
21
|
-
|
|
21
|
+
const defer = promise;
|
|
22
22
|
defer.resolve = res;
|
|
23
23
|
defer.reject = rej;
|
|
24
24
|
return defer;
|
|
25
25
|
}
|
|
26
|
-
function when(promises
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
function when(promises) {
|
|
27
|
+
let objects;
|
|
28
|
+
const arrayArgument = (0, _isArray.default)(promises);
|
|
29
29
|
if (arrayArgument) {
|
|
30
30
|
objects = promises;
|
|
31
31
|
} else {
|
|
32
32
|
objects = arguments;
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
let total = objects.length;
|
|
35
|
+
let hadError = false;
|
|
36
|
+
const results = [];
|
|
37
|
+
const returnValue = arrayArgument ? [results] : results;
|
|
38
|
+
const errors = [];
|
|
39
39
|
results.length = objects.length;
|
|
40
40
|
errors.length = objects.length;
|
|
41
41
|
if (total === 0) {
|
|
42
42
|
return _promise.default.resolve(returnValue);
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const promise = resolvingPromise();
|
|
45
|
+
const resolveOne = function () {
|
|
46
46
|
total--;
|
|
47
47
|
if (total <= 0) {
|
|
48
48
|
if (hadError) {
|
|
@@ -52,7 +52,7 @@ function when(promises /*: any*/) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
|
|
55
|
+
const chain = function (object, index) {
|
|
56
56
|
if (object && typeof object.then === 'function') {
|
|
57
57
|
object.then(function (result) {
|
|
58
58
|
results[index] = result;
|
|
@@ -67,14 +67,14 @@ function when(promises /*: any*/) {
|
|
|
67
67
|
resolveOne();
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
|
-
for (
|
|
70
|
+
for (let i = 0; i < objects.length; i++) {
|
|
71
71
|
chain(objects[i], i);
|
|
72
72
|
}
|
|
73
73
|
return promise;
|
|
74
74
|
}
|
|
75
|
-
function continueWhile(test
|
|
75
|
+
function continueWhile(test, emitter) {
|
|
76
76
|
if (test()) {
|
|
77
|
-
return emitter().then(
|
|
77
|
+
return emitter().then(() => {
|
|
78
78
|
return continueWhile(test, emitter);
|
|
79
79
|
});
|
|
80
80
|
}
|
package/lib/browser/unique.js
CHANGED
|
@@ -10,10 +10,10 @@ var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-st
|
|
|
10
10
|
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
11
11
|
var _arrayContainsObject = _interopRequireDefault(require("./arrayContainsObject"));
|
|
12
12
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
13
|
-
function unique
|
|
14
|
-
|
|
15
|
-
(0, _forEach.default)(arr).call(arr,
|
|
16
|
-
|
|
13
|
+
function unique(arr) {
|
|
14
|
+
const uniques = [];
|
|
15
|
+
(0, _forEach.default)(arr).call(arr, value => {
|
|
16
|
+
const ParseObject = _CoreManager.default.getParseObject();
|
|
17
17
|
if (value instanceof ParseObject) {
|
|
18
18
|
if (!(0, _arrayContainsObject.default)(uniques, value)) {
|
|
19
19
|
uniques.push(value);
|
|
@@ -10,7 +10,6 @@ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
10
10
|
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
11
11
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
12
12
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
13
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
14
13
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
15
14
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
16
15
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
@@ -22,39 +21,39 @@ var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
|
22
21
|
* @param {boolean} allowDeepUnsaved
|
|
23
22
|
* @returns {Array}
|
|
24
23
|
*/
|
|
25
|
-
function unsavedChildren(obj
|
|
26
|
-
|
|
24
|
+
function unsavedChildren(obj, allowDeepUnsaved) {
|
|
25
|
+
const encountered = {
|
|
27
26
|
objects: {},
|
|
28
27
|
files: []
|
|
29
28
|
};
|
|
30
|
-
|
|
29
|
+
const identifier = obj.className + ':' + obj._getId();
|
|
31
30
|
encountered.objects[identifier] = obj.dirty() ? obj : true;
|
|
32
|
-
|
|
33
|
-
for (
|
|
34
|
-
if (
|
|
31
|
+
const attributes = obj.attributes;
|
|
32
|
+
for (const attr in attributes) {
|
|
33
|
+
if (typeof attributes[attr] === 'object') {
|
|
35
34
|
traverse(attributes[attr], encountered, false, !!allowDeepUnsaved);
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
for (
|
|
37
|
+
const unsaved = [];
|
|
38
|
+
for (const id in encountered.objects) {
|
|
40
39
|
if (id !== identifier && encountered.objects[id] !== true) {
|
|
41
40
|
unsaved.push(encountered.objects[id]);
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
return (0, _concat.default)(unsaved).call(unsaved, encountered.files);
|
|
45
44
|
}
|
|
46
|
-
function traverse(obj
|
|
47
|
-
|
|
45
|
+
function traverse(obj, encountered, shouldThrow, allowDeepUnsaved) {
|
|
46
|
+
const ParseObject = _CoreManager.default.getParseObject();
|
|
48
47
|
if (obj instanceof ParseObject) {
|
|
49
48
|
if (!obj.id && shouldThrow) {
|
|
50
49
|
throw new Error('Cannot create a pointer to an unsaved Object.');
|
|
51
50
|
}
|
|
52
|
-
|
|
53
|
-
if (!encountered.objects[
|
|
54
|
-
encountered.objects[
|
|
55
|
-
|
|
56
|
-
for (
|
|
57
|
-
if (
|
|
51
|
+
const identifier = obj.className + ':' + obj._getId();
|
|
52
|
+
if (!encountered.objects[identifier]) {
|
|
53
|
+
encountered.objects[identifier] = obj.dirty() ? obj : true;
|
|
54
|
+
const attributes = obj.attributes;
|
|
55
|
+
for (const attr in attributes) {
|
|
56
|
+
if (typeof attributes[attr] === 'object') {
|
|
58
57
|
traverse(attributes[attr], encountered, !allowDeepUnsaved, allowDeepUnsaved);
|
|
59
58
|
}
|
|
60
59
|
}
|
|
@@ -72,14 +71,14 @@ function traverse(obj /*: ParseObject*/, encountered /*: EncounterMap*/, shouldT
|
|
|
72
71
|
return;
|
|
73
72
|
}
|
|
74
73
|
if ((0, _isArray.default)(obj)) {
|
|
75
|
-
(0, _forEach.default)(obj).call(obj,
|
|
76
|
-
if (
|
|
74
|
+
(0, _forEach.default)(obj).call(obj, el => {
|
|
75
|
+
if (typeof el === 'object') {
|
|
77
76
|
traverse(el, encountered, shouldThrow, allowDeepUnsaved);
|
|
78
77
|
}
|
|
79
78
|
});
|
|
80
79
|
}
|
|
81
|
-
for (
|
|
82
|
-
if (
|
|
80
|
+
for (const k in obj) {
|
|
81
|
+
if (typeof obj[k] === 'object') {
|
|
83
82
|
traverse(obj[k], encountered, shouldThrow, allowDeepUnsaved);
|
|
84
83
|
}
|
|
85
84
|
}
|
package/lib/browser/uuid.js
CHANGED
|
@@ -6,8 +6,6 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _uuid = require("uuid");
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
let uuid = _uuid.v4;
|
|
11
10
|
module.exports = uuid;
|
|
12
|
-
var _default = uuid;
|
|
13
|
-
exports.default = _default;
|
|
11
|
+
var _default = exports.default = uuid;
|
package/lib/node/Analytics.js
CHANGED
|
@@ -10,10 +10,6 @@ function _interopRequireDefault(obj) {
|
|
|
10
10
|
default: obj
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
14
|
-
* @flow
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
13
|
/**
|
|
18
14
|
* Parse.Analytics provides an interface to Parse's logging and analytics
|
|
19
15
|
* backend.
|
|
@@ -54,7 +50,7 @@ function _interopRequireDefault(obj) {
|
|
|
54
50
|
* @returns {Promise} A promise that is resolved when the round-trip
|
|
55
51
|
* to the server completes.
|
|
56
52
|
*/
|
|
57
|
-
function track(name
|
|
53
|
+
function track(name, dimensions) {
|
|
58
54
|
name = name || '';
|
|
59
55
|
name = name.replace(/^\s*/, '');
|
|
60
56
|
name = name.replace(/\s*$/, '');
|
|
@@ -72,7 +68,7 @@ const DefaultController = {
|
|
|
72
68
|
track(name, dimensions) {
|
|
73
69
|
const RESTController = _CoreManager.default.getRESTController();
|
|
74
70
|
return RESTController.request('POST', 'events/' + name, {
|
|
75
|
-
dimensions
|
|
71
|
+
dimensions
|
|
76
72
|
});
|
|
77
73
|
}
|
|
78
74
|
};
|
|
@@ -5,16 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _ParseUser = _interopRequireDefault(require("./ParseUser"));
|
|
8
|
+
var _uuid = _interopRequireDefault(require("./uuid"));
|
|
8
9
|
function _interopRequireDefault(obj) {
|
|
9
10
|
return obj && obj.__esModule ? obj : {
|
|
10
11
|
default: obj
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
|
-
/**
|
|
14
|
-
* @flow-weak
|
|
15
|
-
*/
|
|
16
|
-
/*:: import type { RequestOptions } from './RESTController';*/
|
|
17
|
-
const uuidv4 = require('./uuid');
|
|
18
14
|
let registered = false;
|
|
19
15
|
|
|
20
16
|
/**
|
|
@@ -57,7 +53,7 @@ const AnonymousUtils = {
|
|
|
57
53
|
* linked to an anonymous user.
|
|
58
54
|
* @static
|
|
59
55
|
*/
|
|
60
|
-
isLinked(user
|
|
56
|
+
isLinked(user) {
|
|
61
57
|
const provider = this._getAuthProvider();
|
|
62
58
|
return user._isLinked(provider.getAuthType());
|
|
63
59
|
},
|
|
@@ -70,7 +66,7 @@ const AnonymousUtils = {
|
|
|
70
66
|
* @returns {Promise} Logged in user
|
|
71
67
|
* @static
|
|
72
68
|
*/
|
|
73
|
-
logIn(options
|
|
69
|
+
logIn(options) {
|
|
74
70
|
const provider = this._getAuthProvider();
|
|
75
71
|
return _ParseUser.default.logInWith(provider.getAuthType(), provider.getAuthData(), options);
|
|
76
72
|
},
|
|
@@ -84,7 +80,7 @@ const AnonymousUtils = {
|
|
|
84
80
|
* @returns {Promise} Linked with User
|
|
85
81
|
* @static
|
|
86
82
|
*/
|
|
87
|
-
link(user
|
|
83
|
+
link(user, options) {
|
|
88
84
|
const provider = this._getAuthProvider();
|
|
89
85
|
return user.linkWith(provider.getAuthType(), provider.getAuthData(), options);
|
|
90
86
|
},
|
|
@@ -96,7 +92,7 @@ const AnonymousUtils = {
|
|
|
96
92
|
* @returns {boolean}
|
|
97
93
|
* @static
|
|
98
94
|
*/
|
|
99
|
-
isRegistered()
|
|
95
|
+
isRegistered() {
|
|
100
96
|
return registered;
|
|
101
97
|
},
|
|
102
98
|
_getAuthProvider() {
|
|
@@ -110,7 +106,7 @@ const AnonymousUtils = {
|
|
|
110
106
|
getAuthData() {
|
|
111
107
|
return {
|
|
112
108
|
authData: {
|
|
113
|
-
id:
|
|
109
|
+
id: (0, _uuid.default)()
|
|
114
110
|
}
|
|
115
111
|
};
|
|
116
112
|
}
|
|
@@ -122,5 +118,4 @@ const AnonymousUtils = {
|
|
|
122
118
|
return provider;
|
|
123
119
|
}
|
|
124
120
|
};
|
|
125
|
-
var _default = AnonymousUtils;
|
|
126
|
-
exports.default = _default;
|
|
121
|
+
var _default = exports.default = AnonymousUtils;
|
package/lib/node/Cloud.js
CHANGED
|
@@ -40,12 +40,12 @@ function _interopRequireDefault(obj) {
|
|
|
40
40
|
* @returns {Promise} A promise that will be resolved with the result
|
|
41
41
|
* of the function.
|
|
42
42
|
*/
|
|
43
|
-
function run(name
|
|
43
|
+
function run(name, data, options) {
|
|
44
44
|
options = options || {};
|
|
45
45
|
if (typeof name !== 'string' || name.length === 0) {
|
|
46
46
|
throw new TypeError('Cloud function name must be a string.');
|
|
47
47
|
}
|
|
48
|
-
const requestOptions
|
|
48
|
+
const requestOptions = {};
|
|
49
49
|
if (options.useMasterKey) {
|
|
50
50
|
requestOptions.useMasterKey = options.useMasterKey;
|
|
51
51
|
}
|
|
@@ -69,7 +69,7 @@ function run(name /*: string*/, data /*: any*/, options /*: RequestOptions*/) /*
|
|
|
69
69
|
* @returns {Promise} A promise that will be resolved with the result
|
|
70
70
|
* of the function.
|
|
71
71
|
*/
|
|
72
|
-
function getJobsData()
|
|
72
|
+
function getJobsData() {
|
|
73
73
|
return _CoreManager.default.getCloudController().getJobsData({
|
|
74
74
|
useMasterKey: true
|
|
75
75
|
});
|
|
@@ -85,7 +85,7 @@ function getJobsData() /*: Promise<any>*/{
|
|
|
85
85
|
* @returns {Promise} A promise that will be resolved with the jobStatusId
|
|
86
86
|
* of the job.
|
|
87
87
|
*/
|
|
88
|
-
function startJob(name
|
|
88
|
+
function startJob(name, data) {
|
|
89
89
|
if (typeof name !== 'string' || name.length === 0) {
|
|
90
90
|
throw new TypeError('Cloud job name must be a string.');
|
|
91
91
|
}
|
|
@@ -102,14 +102,14 @@ function startJob(name /*: string*/, data /*: any*/) /*: Promise<string>*/{
|
|
|
102
102
|
* @param {string} jobStatusId The Id of Job Status.
|
|
103
103
|
* @returns {Parse.Object} Status of Job.
|
|
104
104
|
*/
|
|
105
|
-
function getJobStatus(jobStatusId
|
|
105
|
+
function getJobStatus(jobStatusId) {
|
|
106
106
|
const query = new _ParseQuery.default('_JobStatus');
|
|
107
107
|
return query.get(jobStatusId, {
|
|
108
108
|
useMasterKey: true
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
const DefaultController = {
|
|
112
|
-
run(name
|
|
112
|
+
run(name, data, options) {
|
|
113
113
|
const RESTController = _CoreManager.default.getRESTController();
|
|
114
114
|
const payload = (0, _encode.default)(data, true);
|
|
115
115
|
const request = RESTController.request('POST', 'functions/' + name, payload, options);
|
|
@@ -124,11 +124,11 @@ const DefaultController = {
|
|
|
124
124
|
return Promise.resolve(undefined);
|
|
125
125
|
});
|
|
126
126
|
},
|
|
127
|
-
getJobsData(options
|
|
127
|
+
getJobsData(options) {
|
|
128
128
|
const RESTController = _CoreManager.default.getRESTController();
|
|
129
129
|
return RESTController.request('GET', 'cloud_code/jobs/data', null, options);
|
|
130
130
|
},
|
|
131
|
-
async startJob(name
|
|
131
|
+
async startJob(name, data, options) {
|
|
132
132
|
var _response$_headers;
|
|
133
133
|
const RESTController = _CoreManager.default.getRESTController();
|
|
134
134
|
const payload = (0, _encode.default)(data, true);
|