parse 4.0.0-alpha.1 → 4.0.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/LICENSE +167 -25
- package/NOTICE +10 -0
- package/README.md +6 -5
- package/dist/parse.js +12838 -21190
- package/dist/parse.min.js +7 -6
- package/dist/parse.weapp.js +7921 -17062
- package/dist/parse.weapp.min.js +7 -6
- package/lib/browser/Analytics.js +2 -27
- package/lib/browser/AnonymousUtils.js +6 -42
- package/lib/browser/Cloud.js +12 -77
- package/lib/browser/CloudCode.js +0 -3
- package/lib/browser/CoreManager.js +46 -191
- package/lib/browser/CryptoController.js +2 -16
- package/lib/browser/EventEmitter.js +1 -8
- package/lib/browser/EventuallyQueue.js +277 -824
- package/lib/browser/FacebookUtils.js +6 -42
- package/lib/browser/IndexedDBStorageController.js +3 -14
- package/lib/browser/InstallationController.js +2 -20
- package/lib/browser/LiveQueryClient.js +105 -213
- package/lib/browser/LiveQuerySubscription.js +10 -39
- package/lib/browser/LocalDatastore.js +451 -1081
- package/lib/browser/LocalDatastoreController.js +145 -602
- package/lib/browser/LocalDatastoreController.react-native.js +137 -573
- package/lib/browser/LocalDatastoreUtils.js +2 -19
- package/lib/browser/ObjectStateMutations.js +18 -121
- package/lib/browser/OfflineQuery.js +61 -222
- package/lib/browser/Parse.js +12 -115
- package/lib/browser/ParseACL.js +33 -148
- package/lib/browser/ParseCLP.js +96 -314
- package/lib/browser/ParseConfig.js +18 -95
- package/lib/browser/ParseError.js +63 -99
- package/lib/browser/ParseFile.js +128 -685
- package/lib/browser/ParseGeoPoint.js +23 -89
- package/lib/browser/ParseHooks.js +1 -34
- package/lib/browser/ParseInstallation.js +4 -32
- package/lib/browser/ParseLiveQuery.js +96 -505
- package/lib/browser/ParseObject.js +665 -1845
- package/lib/browser/ParseOp.js +41 -287
- package/lib/browser/ParsePolygon.js +13 -70
- package/lib/browser/ParseQuery.js +403 -1504
- package/lib/browser/ParseRelation.js +12 -68
- package/lib/browser/ParseRole.js +13 -75
- package/lib/browser/ParseSchema.js +49 -208
- package/lib/browser/ParseSession.js +11 -69
- package/lib/browser/ParseUser.js +274 -1127
- package/lib/browser/Push.js +7 -50
- package/lib/browser/RESTController.js +28 -157
- package/lib/browser/SingleInstanceStateController.js +19 -144
- package/lib/browser/Socket.weapp.js +0 -10
- package/lib/browser/Storage.js +10 -80
- package/lib/browser/StorageController.browser.js +4 -24
- package/lib/browser/StorageController.default.js +4 -24
- package/lib/browser/StorageController.react-native.js +6 -40
- package/lib/browser/StorageController.weapp.js +5 -23
- package/lib/browser/TaskQueue.js +1 -29
- package/lib/browser/UniqueInstanceStateController.js +19 -149
- package/lib/browser/Xhr.weapp.js +0 -17
- package/lib/browser/arrayContainsObject.js +2 -23
- package/lib/browser/canBeSerialized.js +3 -40
- package/lib/browser/decode.js +3 -40
- package/lib/browser/encode.js +9 -77
- package/lib/browser/equals.js +2 -34
- package/lib/browser/escape.js +1 -15
- package/lib/browser/isRevocableSession.js +2 -18
- package/lib/browser/parseDate.js +2 -20
- package/lib/browser/promiseUtils.js +3 -21
- package/lib/browser/unique.js +3 -24
- package/lib/browser/unsavedChildren.js +6 -57
- package/lib/browser/uuid.js +3 -1
- package/lib/node/Analytics.js +1 -25
- package/lib/node/AnonymousUtils.js +5 -44
- package/lib/node/Cloud.js +10 -73
- package/lib/node/CloudCode.js +0 -3
- package/lib/node/CoreManager.js +47 -227
- package/lib/node/CryptoController.js +2 -16
- package/lib/node/EventEmitter.js +1 -8
- package/lib/node/EventuallyQueue.js +16 -123
- package/lib/node/FacebookUtils.js +5 -44
- package/lib/node/IndexedDBStorageController.js +3 -19
- package/lib/node/InstallationController.js +2 -22
- package/lib/node/LiveQueryClient.js +72 -154
- package/lib/node/LiveQuerySubscription.js +7 -26
- package/lib/node/LocalDatastore.js +19 -182
- package/lib/node/LocalDatastoreController.js +6 -45
- package/lib/node/LocalDatastoreController.react-native.js +6 -52
- package/lib/node/LocalDatastoreUtils.js +1 -13
- package/lib/node/ObjectStateMutations.js +13 -100
- package/lib/node/OfflineQuery.js +27 -151
- package/lib/node/Parse.js +11 -108
- package/lib/node/ParseACL.js +32 -157
- package/lib/node/ParseCLP.js +69 -269
- package/lib/node/ParseConfig.js +16 -91
- package/lib/node/ParseError.js +61 -74
- package/lib/node/ParseFile.js +49 -212
- package/lib/node/ParseGeoPoint.js +21 -89
- package/lib/node/ParseHooks.js +0 -35
- package/lib/node/ParseInstallation.js +1 -17
- package/lib/node/ParseLiveQuery.js +10 -43
- package/lib/node/ParseObject.js +229 -964
- package/lib/node/ParseOp.js +31 -262
- package/lib/node/ParsePolygon.js +12 -69
- package/lib/node/ParseQuery.js +169 -888
- package/lib/node/ParseRelation.js +11 -68
- package/lib/node/ParseRole.js +10 -64
- package/lib/node/ParseSchema.js +46 -229
- package/lib/node/ParseSession.js +8 -57
- package/lib/node/ParseUser.js +107 -583
- package/lib/node/Push.js +4 -44
- package/lib/node/RESTController.js +18 -127
- package/lib/node/SingleInstanceStateController.js +17 -137
- package/lib/node/Socket.weapp.js +0 -7
- package/lib/node/Storage.js +10 -90
- package/lib/node/StorageController.browser.js +4 -30
- package/lib/node/StorageController.default.js +5 -28
- package/lib/node/StorageController.react-native.js +6 -47
- package/lib/node/StorageController.weapp.js +6 -28
- package/lib/node/TaskQueue.js +1 -24
- package/lib/node/UniqueInstanceStateController.js +16 -140
- package/lib/node/Xhr.weapp.js +0 -15
- package/lib/node/arrayContainsObject.js +1 -19
- package/lib/node/canBeSerialized.js +2 -35
- package/lib/node/decode.js +1 -33
- package/lib/node/encode.js +3 -61
- package/lib/node/equals.js +0 -27
- package/lib/node/escape.js +1 -13
- package/lib/node/isRevocableSession.js +1 -12
- package/lib/node/parseDate.js +1 -14
- package/lib/node/promiseUtils.js +2 -14
- package/lib/node/unique.js +1 -18
- package/lib/node/unsavedChildren.js +2 -45
- package/lib/node/uuid.js +6 -1
- package/lib/react-native/Analytics.js +0 -9
- package/lib/react-native/AnonymousUtils.js +0 -10
- package/lib/react-native/Cloud.js +0 -26
- package/lib/react-native/CoreManager.js +2 -6
- package/lib/react-native/CryptoController.js +0 -2
- package/lib/react-native/EventEmitter.js +0 -2
- package/lib/react-native/EventuallyQueue.js +156 -711
- package/lib/react-native/FacebookUtils.js +0 -22
- package/lib/react-native/IndexedDBStorageController.js +0 -1
- package/lib/react-native/InstallationController.js +0 -6
- package/lib/react-native/LiveQueryClient.js +46 -157
- package/lib/react-native/LiveQuerySubscription.js +3 -27
- package/lib/react-native/LocalDatastore.js +281 -948
- package/lib/react-native/LocalDatastoreController.js +71 -552
- package/lib/react-native/LocalDatastoreController.react-native.js +91 -526
- package/lib/react-native/LocalDatastoreUtils.js +0 -1
- package/lib/react-native/ObjectStateMutations.js +2 -65
- package/lib/react-native/OfflineQuery.js +25 -196
- package/lib/react-native/Parse.js +0 -65
- package/lib/react-native/ParseACL.js +0 -44
- package/lib/react-native/ParseCLP.js +23 -161
- package/lib/react-native/ParseConfig.js +0 -42
- package/lib/react-native/ParseError.js +1 -21
- package/lib/react-native/ParseFile.js +55 -529
- package/lib/react-native/ParseGeoPoint.js +0 -17
- package/lib/react-native/ParseHooks.js +0 -30
- package/lib/react-native/ParseInstallation.js +1 -23
- package/lib/react-native/ParseLiveQuery.js +55 -472
- package/lib/react-native/ParseObject.js +245 -1246
- package/lib/react-native/ParseOp.js +1 -138
- package/lib/react-native/ParsePolygon.js +0 -24
- package/lib/react-native/ParseQuery.js +182 -874
- package/lib/react-native/ParseRelation.js +0 -25
- package/lib/react-native/ParseRole.js +1 -36
- package/lib/react-native/ParseSchema.js +3 -54
- package/lib/react-native/ParseSession.js +1 -40
- package/lib/react-native/ParseUser.js +95 -773
- package/lib/react-native/Push.js +0 -16
- package/lib/react-native/RESTController.js +12 -109
- package/lib/react-native/SingleInstanceStateController.js +0 -44
- package/lib/react-native/Socket.weapp.js +0 -10
- package/lib/react-native/Storage.js +0 -24
- package/lib/react-native/StorageController.browser.js +0 -2
- package/lib/react-native/StorageController.default.js +0 -1
- package/lib/react-native/StorageController.react-native.js +0 -2
- package/lib/react-native/TaskQueue.js +0 -15
- package/lib/react-native/UniqueInstanceStateController.js +0 -47
- package/lib/react-native/Xhr.weapp.js +0 -16
- package/lib/react-native/arrayContainsObject.js +0 -5
- package/lib/react-native/canBeSerialized.js +0 -18
- package/lib/react-native/decode.js +0 -21
- package/lib/react-native/encode.js +0 -25
- package/lib/react-native/equals.js +0 -18
- package/lib/react-native/escape.js +0 -1
- package/lib/react-native/isRevocableSession.js +0 -1
- package/lib/react-native/parseDate.js +0 -3
- package/lib/react-native/promiseUtils.js +0 -13
- package/lib/react-native/unique.js +0 -4
- package/lib/react-native/unsavedChildren.js +0 -21
- package/lib/react-native/uuid.js +3 -1
- package/lib/weapp/Analytics.js +2 -27
- package/lib/weapp/AnonymousUtils.js +6 -42
- package/lib/weapp/Cloud.js +12 -77
- package/lib/weapp/CloudCode.js +0 -3
- package/lib/weapp/CoreManager.js +46 -191
- package/lib/weapp/CryptoController.js +2 -16
- package/lib/weapp/EventEmitter.js +1 -8
- package/lib/weapp/EventuallyQueue.js +277 -824
- package/lib/weapp/FacebookUtils.js +6 -42
- package/lib/weapp/IndexedDBStorageController.js +3 -14
- package/lib/weapp/InstallationController.js +2 -20
- package/lib/weapp/LiveQueryClient.js +105 -213
- package/lib/weapp/LiveQuerySubscription.js +10 -39
- package/lib/weapp/LocalDatastore.js +451 -1081
- package/lib/weapp/LocalDatastoreController.js +145 -602
- package/lib/weapp/LocalDatastoreController.react-native.js +137 -573
- package/lib/weapp/LocalDatastoreUtils.js +2 -19
- package/lib/weapp/ObjectStateMutations.js +18 -121
- package/lib/weapp/OfflineQuery.js +61 -222
- package/lib/weapp/Parse.js +12 -115
- package/lib/weapp/ParseACL.js +33 -148
- package/lib/weapp/ParseCLP.js +96 -314
- package/lib/weapp/ParseConfig.js +18 -95
- package/lib/weapp/ParseError.js +63 -99
- package/lib/weapp/ParseFile.js +129 -686
- package/lib/weapp/ParseGeoPoint.js +23 -89
- package/lib/weapp/ParseHooks.js +1 -34
- package/lib/weapp/ParseInstallation.js +4 -32
- package/lib/weapp/ParseLiveQuery.js +96 -505
- package/lib/weapp/ParseObject.js +665 -1845
- package/lib/weapp/ParseOp.js +41 -287
- package/lib/weapp/ParsePolygon.js +13 -70
- package/lib/weapp/ParseQuery.js +403 -1504
- package/lib/weapp/ParseRelation.js +12 -68
- package/lib/weapp/ParseRole.js +13 -75
- package/lib/weapp/ParseSchema.js +49 -208
- package/lib/weapp/ParseSession.js +11 -69
- package/lib/weapp/ParseUser.js +274 -1127
- package/lib/weapp/Push.js +7 -50
- package/lib/weapp/RESTController.js +28 -157
- package/lib/weapp/SingleInstanceStateController.js +19 -144
- package/lib/weapp/Socket.weapp.js +0 -10
- package/lib/weapp/Storage.js +10 -80
- package/lib/weapp/StorageController.browser.js +4 -24
- package/lib/weapp/StorageController.default.js +4 -24
- package/lib/weapp/StorageController.react-native.js +6 -40
- package/lib/weapp/StorageController.weapp.js +5 -23
- package/lib/weapp/TaskQueue.js +1 -29
- package/lib/weapp/UniqueInstanceStateController.js +19 -149
- package/lib/weapp/Xhr.weapp.js +0 -17
- package/lib/weapp/arrayContainsObject.js +2 -23
- package/lib/weapp/canBeSerialized.js +3 -40
- package/lib/weapp/decode.js +3 -40
- package/lib/weapp/encode.js +9 -77
- package/lib/weapp/equals.js +2 -34
- package/lib/weapp/escape.js +1 -15
- package/lib/weapp/isRevocableSession.js +2 -18
- package/lib/weapp/parseDate.js +2 -20
- package/lib/weapp/promiseUtils.js +3 -21
- package/lib/weapp/unique.js +3 -24
- package/lib/weapp/unsavedChildren.js +6 -57
- package/lib/weapp/uuid.js +1 -6
- package/package.json +34 -30
- package/PATENTS +0 -37
|
@@ -4,92 +4,59 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = canBeSerialized;
|
|
7
|
-
|
|
8
7
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
9
|
-
|
|
10
8
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
11
|
-
|
|
12
9
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) {
|
|
15
11
|
return obj && obj.__esModule ? obj : {
|
|
16
12
|
default: obj
|
|
17
13
|
};
|
|
18
14
|
}
|
|
19
15
|
/**
|
|
20
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
21
|
-
* All rights reserved.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the BSD-style license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
25
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
26
|
-
*
|
|
27
16
|
* @flow
|
|
28
17
|
*/
|
|
29
18
|
|
|
30
|
-
|
|
31
|
-
function canBeSerialized(obj
|
|
32
|
-
/*: ParseObject*/
|
|
33
|
-
)
|
|
34
|
-
/*: boolean*/
|
|
35
|
-
{
|
|
19
|
+
function canBeSerialized(obj /*: ParseObject*/) /*: boolean*/{
|
|
36
20
|
if (!(obj instanceof _ParseObject.default)) {
|
|
37
21
|
return true;
|
|
38
22
|
}
|
|
39
|
-
|
|
40
23
|
const attributes = obj.attributes;
|
|
41
|
-
|
|
42
24
|
for (const attr in attributes) {
|
|
43
25
|
const val = attributes[attr];
|
|
44
|
-
|
|
45
26
|
if (!canBeSerializedHelper(val)) {
|
|
46
27
|
return false;
|
|
47
28
|
}
|
|
48
29
|
}
|
|
49
|
-
|
|
50
30
|
return true;
|
|
51
31
|
}
|
|
52
|
-
|
|
53
|
-
function canBeSerializedHelper(value
|
|
54
|
-
/*: any*/
|
|
55
|
-
)
|
|
56
|
-
/*: boolean*/
|
|
57
|
-
{
|
|
32
|
+
function canBeSerializedHelper(value /*: any*/) /*: boolean*/{
|
|
58
33
|
if (typeof value !== 'object') {
|
|
59
34
|
return true;
|
|
60
35
|
}
|
|
61
|
-
|
|
62
36
|
if (value instanceof _ParseRelation.default) {
|
|
63
37
|
return true;
|
|
64
38
|
}
|
|
65
|
-
|
|
66
39
|
if (value instanceof _ParseObject.default) {
|
|
67
40
|
return !!value.id;
|
|
68
41
|
}
|
|
69
|
-
|
|
70
42
|
if (value instanceof _ParseFile.default) {
|
|
71
43
|
if (value.url()) {
|
|
72
44
|
return true;
|
|
73
45
|
}
|
|
74
|
-
|
|
75
46
|
return false;
|
|
76
47
|
}
|
|
77
|
-
|
|
78
48
|
if (Array.isArray(value)) {
|
|
79
49
|
for (let i = 0; i < value.length; i++) {
|
|
80
50
|
if (!canBeSerializedHelper(value[i])) {
|
|
81
51
|
return false;
|
|
82
52
|
}
|
|
83
53
|
}
|
|
84
|
-
|
|
85
54
|
return true;
|
|
86
55
|
}
|
|
87
|
-
|
|
88
56
|
for (const k in value) {
|
|
89
57
|
if (!canBeSerializedHelper(value[k])) {
|
|
90
58
|
return false;
|
|
91
59
|
}
|
|
92
60
|
}
|
|
93
|
-
|
|
94
61
|
return true;
|
|
95
62
|
}
|
package/lib/node/decode.js
CHANGED
|
@@ -4,48 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = decode;
|
|
7
|
-
|
|
8
7
|
var _ParseACL = _interopRequireDefault(require("./ParseACL"));
|
|
9
|
-
|
|
10
8
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
11
|
-
|
|
12
9
|
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
13
|
-
|
|
14
10
|
var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
|
|
15
|
-
|
|
16
11
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
17
|
-
|
|
18
12
|
var _ParseOp = require("./ParseOp");
|
|
19
|
-
|
|
20
13
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) {
|
|
23
15
|
return obj && obj.__esModule ? obj : {
|
|
24
16
|
default: obj
|
|
25
17
|
};
|
|
26
18
|
}
|
|
27
19
|
/**
|
|
28
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
29
|
-
* All rights reserved.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the BSD-style license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
33
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
34
|
-
*
|
|
35
20
|
* @flow
|
|
36
21
|
*/
|
|
37
22
|
// eslint-disable-line no-unused-vars
|
|
38
23
|
|
|
39
|
-
|
|
40
|
-
function decode(value
|
|
41
|
-
/*: any*/
|
|
42
|
-
)
|
|
43
|
-
/*: any*/
|
|
44
|
-
{
|
|
24
|
+
function decode(value /*: any*/) /*: any*/{
|
|
45
25
|
if (value === null || typeof value !== 'object' || value instanceof Date) {
|
|
46
26
|
return value;
|
|
47
27
|
}
|
|
48
|
-
|
|
49
28
|
if (Array.isArray(value)) {
|
|
50
29
|
const dup = [];
|
|
51
30
|
value.forEach((v, i) => {
|
|
@@ -53,50 +32,39 @@ function decode(value
|
|
|
53
32
|
});
|
|
54
33
|
return dup;
|
|
55
34
|
}
|
|
56
|
-
|
|
57
35
|
if (typeof value.__op === 'string') {
|
|
58
36
|
return (0, _ParseOp.opFromJSON)(value);
|
|
59
37
|
}
|
|
60
|
-
|
|
61
38
|
if (value.__type === 'Pointer' && value.className) {
|
|
62
39
|
return _ParseObject.default.fromJSON(value);
|
|
63
40
|
}
|
|
64
|
-
|
|
65
41
|
if (value.__type === 'Object' && value.className) {
|
|
66
42
|
return _ParseObject.default.fromJSON(value);
|
|
67
43
|
}
|
|
68
|
-
|
|
69
44
|
if (value.__type === 'Relation') {
|
|
70
45
|
// The parent and key fields will be populated by the parent
|
|
71
46
|
const relation = new _ParseRelation.default(null, null);
|
|
72
47
|
relation.targetClassName = value.className;
|
|
73
48
|
return relation;
|
|
74
49
|
}
|
|
75
|
-
|
|
76
50
|
if (value.__type === 'Date') {
|
|
77
51
|
return new Date(value.iso);
|
|
78
52
|
}
|
|
79
|
-
|
|
80
53
|
if (value.__type === 'File') {
|
|
81
54
|
return _ParseFile.default.fromJSON(value);
|
|
82
55
|
}
|
|
83
|
-
|
|
84
56
|
if (value.__type === 'GeoPoint') {
|
|
85
57
|
return new _ParseGeoPoint.default({
|
|
86
58
|
latitude: value.latitude,
|
|
87
59
|
longitude: value.longitude
|
|
88
60
|
});
|
|
89
61
|
}
|
|
90
|
-
|
|
91
62
|
if (value.__type === 'Polygon') {
|
|
92
63
|
return new _ParsePolygon.default(value.coordinates);
|
|
93
64
|
}
|
|
94
|
-
|
|
95
65
|
const copy = {};
|
|
96
|
-
|
|
97
66
|
for (const k in value) {
|
|
98
67
|
copy[k] = decode(value[k]);
|
|
99
68
|
}
|
|
100
|
-
|
|
101
69
|
return copy;
|
|
102
70
|
}
|
package/lib/node/encode.js
CHANGED
|
@@ -4,130 +4,72 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = _default;
|
|
7
|
-
|
|
8
7
|
var _ParseACL = _interopRequireDefault(require("./ParseACL"));
|
|
9
|
-
|
|
10
8
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
11
|
-
|
|
12
9
|
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
13
|
-
|
|
14
10
|
var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
|
|
15
|
-
|
|
16
11
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
17
|
-
|
|
18
12
|
var _ParseOp = require("./ParseOp");
|
|
19
|
-
|
|
20
13
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) {
|
|
23
15
|
return obj && obj.__esModule ? obj : {
|
|
24
16
|
default: obj
|
|
25
17
|
};
|
|
26
18
|
}
|
|
27
19
|
/**
|
|
28
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
29
|
-
* All rights reserved.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the BSD-style license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
33
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
34
|
-
*
|
|
35
20
|
* @flow
|
|
36
21
|
*/
|
|
37
22
|
|
|
38
|
-
|
|
39
|
-
function encode(value
|
|
40
|
-
/*: mixed*/
|
|
41
|
-
, disallowObjects
|
|
42
|
-
/*: boolean*/
|
|
43
|
-
, forcePointers
|
|
44
|
-
/*: boolean*/
|
|
45
|
-
, seen
|
|
46
|
-
/*: Array<mixed>*/
|
|
47
|
-
, offline
|
|
48
|
-
/*: boolean*/
|
|
49
|
-
)
|
|
50
|
-
/*: any*/
|
|
51
|
-
{
|
|
23
|
+
function encode(value /*: mixed*/, disallowObjects /*: boolean*/, forcePointers /*: boolean*/, seen /*: Array<mixed>*/, offline /*: boolean*/) /*: any*/{
|
|
52
24
|
if (value instanceof _ParseObject.default) {
|
|
53
25
|
if (disallowObjects) {
|
|
54
26
|
throw new Error('Parse Objects not allowed here');
|
|
55
27
|
}
|
|
56
|
-
|
|
57
28
|
const seenEntry = value.id ? value.className + ':' + value.id : value;
|
|
58
|
-
|
|
59
29
|
if (forcePointers || !seen || seen.indexOf(seenEntry) > -1 || value.dirty() || Object.keys(value._getServerData()).length < 1) {
|
|
60
30
|
if (offline && value._getId().startsWith('local')) {
|
|
61
31
|
return value.toOfflinePointer();
|
|
62
32
|
}
|
|
63
|
-
|
|
64
33
|
return value.toPointer();
|
|
65
34
|
}
|
|
66
|
-
|
|
67
35
|
seen = seen.concat(seenEntry);
|
|
68
36
|
return value._toFullJSON(seen, offline);
|
|
69
37
|
}
|
|
70
|
-
|
|
71
38
|
if (value instanceof _ParseOp.Op || value instanceof _ParseACL.default || value instanceof _ParseGeoPoint.default || value instanceof _ParsePolygon.default || value instanceof _ParseRelation.default) {
|
|
72
39
|
return value.toJSON();
|
|
73
40
|
}
|
|
74
|
-
|
|
75
41
|
if (value instanceof _ParseFile.default) {
|
|
76
42
|
if (!value.url()) {
|
|
77
43
|
throw new Error('Tried to encode an unsaved file.');
|
|
78
44
|
}
|
|
79
|
-
|
|
80
45
|
return value.toJSON();
|
|
81
46
|
}
|
|
82
|
-
|
|
83
47
|
if (Object.prototype.toString.call(value) === '[object Date]') {
|
|
84
48
|
if (isNaN(value)) {
|
|
85
49
|
throw new Error('Tried to encode an invalid date.');
|
|
86
50
|
}
|
|
87
|
-
|
|
88
51
|
return {
|
|
89
52
|
__type: 'Date',
|
|
90
|
-
iso: value
|
|
91
|
-
/*: any*/
|
|
92
|
-
.toJSON()
|
|
53
|
+
iso: value /*: any*/.toJSON()
|
|
93
54
|
};
|
|
94
55
|
}
|
|
95
|
-
|
|
96
56
|
if (Object.prototype.toString.call(value) === '[object RegExp]' && typeof value.source === 'string') {
|
|
97
57
|
return value.source;
|
|
98
58
|
}
|
|
99
|
-
|
|
100
59
|
if (Array.isArray(value)) {
|
|
101
60
|
return value.map(v => {
|
|
102
61
|
return encode(v, disallowObjects, forcePointers, seen, offline);
|
|
103
62
|
});
|
|
104
63
|
}
|
|
105
|
-
|
|
106
64
|
if (value && typeof value === 'object') {
|
|
107
65
|
const output = {};
|
|
108
|
-
|
|
109
66
|
for (const k in value) {
|
|
110
67
|
output[k] = encode(value[k], disallowObjects, forcePointers, seen, offline);
|
|
111
68
|
}
|
|
112
|
-
|
|
113
69
|
return output;
|
|
114
70
|
}
|
|
115
|
-
|
|
116
71
|
return value;
|
|
117
72
|
}
|
|
118
|
-
|
|
119
|
-
function _default(value
|
|
120
|
-
/*: mixed*/
|
|
121
|
-
, disallowObjects
|
|
122
|
-
/*:: ?: boolean*/
|
|
123
|
-
, forcePointers
|
|
124
|
-
/*:: ?: boolean*/
|
|
125
|
-
, seen
|
|
126
|
-
/*:: ?: Array<mixed>*/
|
|
127
|
-
, offline
|
|
128
|
-
/*:: ?: boolean*/
|
|
129
|
-
)
|
|
130
|
-
/*: any*/
|
|
131
|
-
{
|
|
73
|
+
function _default(value /*: mixed*/, disallowObjects /*:: ?: boolean*/, forcePointers /*:: ?: boolean*/, seen /*:: ?: Array<mixed>*/, offline /*:: ?: boolean*/) /*: any*/{
|
|
132
74
|
return encode(value, !!disallowObjects, !!forcePointers, seen || [], offline);
|
|
133
75
|
}
|
package/lib/node/equals.js
CHANGED
|
@@ -4,85 +4,58 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = equals;
|
|
7
|
-
|
|
8
7
|
var _ParseACL = _interopRequireDefault(require("./ParseACL"));
|
|
9
|
-
|
|
10
8
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
11
|
-
|
|
12
9
|
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
13
|
-
|
|
14
10
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) {
|
|
17
12
|
return obj && obj.__esModule ? obj : {
|
|
18
13
|
default: obj
|
|
19
14
|
};
|
|
20
15
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
23
|
-
* All rights reserved.
|
|
24
|
-
*
|
|
25
|
-
* This source code is licensed under the BSD-style license found in the
|
|
26
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
27
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
16
|
function equals(a, b) {
|
|
32
17
|
const toString = Object.prototype.toString;
|
|
33
|
-
|
|
34
18
|
if (toString.call(a) === '[object Date]' || toString.call(b) === '[object Date]') {
|
|
35
19
|
const dateA = new Date(a);
|
|
36
20
|
const dateB = new Date(b);
|
|
37
21
|
return +dateA === +dateB;
|
|
38
22
|
}
|
|
39
|
-
|
|
40
23
|
if (typeof a !== typeof b) {
|
|
41
24
|
return false;
|
|
42
25
|
}
|
|
43
|
-
|
|
44
26
|
if (!a || typeof a !== 'object') {
|
|
45
27
|
// a is a primitive
|
|
46
28
|
return a === b;
|
|
47
29
|
}
|
|
48
|
-
|
|
49
30
|
if (Array.isArray(a) || Array.isArray(b)) {
|
|
50
31
|
if (!Array.isArray(a) || !Array.isArray(b)) {
|
|
51
32
|
return false;
|
|
52
33
|
}
|
|
53
|
-
|
|
54
34
|
if (a.length !== b.length) {
|
|
55
35
|
return false;
|
|
56
36
|
}
|
|
57
|
-
|
|
58
37
|
for (let i = a.length; i--;) {
|
|
59
38
|
if (!equals(a[i], b[i])) {
|
|
60
39
|
return false;
|
|
61
40
|
}
|
|
62
41
|
}
|
|
63
|
-
|
|
64
42
|
return true;
|
|
65
43
|
}
|
|
66
|
-
|
|
67
44
|
if (a instanceof _ParseACL.default || a instanceof _ParseFile.default || a instanceof _ParseGeoPoint.default || a instanceof _ParseObject.default) {
|
|
68
45
|
return a.equals(b);
|
|
69
46
|
}
|
|
70
|
-
|
|
71
47
|
if (b instanceof _ParseObject.default) {
|
|
72
48
|
if (a.__type === 'Object' || a.__type === 'Pointer') {
|
|
73
49
|
return a.objectId === b.id && a.className === b.className;
|
|
74
50
|
}
|
|
75
51
|
}
|
|
76
|
-
|
|
77
52
|
if (Object.keys(a).length !== Object.keys(b).length) {
|
|
78
53
|
return false;
|
|
79
54
|
}
|
|
80
|
-
|
|
81
55
|
for (const k in a) {
|
|
82
56
|
if (!equals(a[k], b[k])) {
|
|
83
57
|
return false;
|
|
84
58
|
}
|
|
85
59
|
}
|
|
86
|
-
|
|
87
60
|
return true;
|
|
88
61
|
}
|
package/lib/node/escape.js
CHANGED
|
@@ -5,13 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = escape;
|
|
7
7
|
/*
|
|
8
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
9
|
-
* All rights reserved.
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the BSD-style license found in the
|
|
12
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
13
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
14
|
-
*
|
|
15
8
|
* @flow
|
|
16
9
|
*/
|
|
17
10
|
|
|
@@ -23,12 +16,7 @@ const encoded = {
|
|
|
23
16
|
"'": ''',
|
|
24
17
|
'"': '"'
|
|
25
18
|
};
|
|
26
|
-
|
|
27
|
-
function escape(str
|
|
28
|
-
/*: string*/
|
|
29
|
-
)
|
|
30
|
-
/*: string*/
|
|
31
|
-
{
|
|
19
|
+
function escape(str /*: string*/) /*: string*/{
|
|
32
20
|
return str.replace(/[&<>\/'"]/g, function (char) {
|
|
33
21
|
return encoded[char];
|
|
34
22
|
});
|
|
@@ -5,20 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = isRevocableSession;
|
|
7
7
|
/**
|
|
8
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
9
|
-
* All rights reserved.
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the BSD-style license found in the
|
|
12
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
13
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
14
|
-
*
|
|
15
8
|
* @flow
|
|
16
9
|
*/
|
|
17
10
|
|
|
18
|
-
function isRevocableSession(token
|
|
19
|
-
/*: string*/
|
|
20
|
-
)
|
|
21
|
-
/*: boolean*/
|
|
22
|
-
{
|
|
11
|
+
function isRevocableSession(token /*: string*/) /*: boolean*/{
|
|
23
12
|
return token.indexOf('r:') > -1;
|
|
24
13
|
}
|
package/lib/node/parseDate.js
CHANGED
|
@@ -5,28 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = parseDate;
|
|
7
7
|
/**
|
|
8
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
9
|
-
* All rights reserved.
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the BSD-style license found in the
|
|
12
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
13
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
14
|
-
*
|
|
15
8
|
* @flow
|
|
16
9
|
*/
|
|
17
10
|
|
|
18
|
-
function parseDate(iso8601
|
|
19
|
-
/*: string*/
|
|
20
|
-
)
|
|
21
|
-
/*: ?Date*/
|
|
22
|
-
{
|
|
11
|
+
function parseDate(iso8601 /*: string*/) /*: ?Date*/{
|
|
23
12
|
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$');
|
|
24
13
|
const match = regexp.exec(iso8601);
|
|
25
|
-
|
|
26
14
|
if (!match) {
|
|
27
15
|
return null;
|
|
28
16
|
}
|
|
29
|
-
|
|
30
17
|
const year = parseInt(match[1]) || 0;
|
|
31
18
|
const month = (parseInt(match[2]) || 1) - 1;
|
|
32
19
|
const day = parseInt(match[3]) || 0;
|
package/lib/node/promiseUtils.js
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.continueWhile = continueWhile;
|
|
7
7
|
exports.resolvingPromise = resolvingPromise;
|
|
8
|
-
exports.when = when;
|
|
9
|
-
|
|
8
|
+
exports.when = when;
|
|
9
|
+
// Create Deferred Promise
|
|
10
10
|
function resolvingPromise() {
|
|
11
11
|
let res;
|
|
12
12
|
let rej;
|
|
@@ -18,17 +18,14 @@ function resolvingPromise() {
|
|
|
18
18
|
promise.reject = rej;
|
|
19
19
|
return promise;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
21
|
function when(promises) {
|
|
23
22
|
let objects;
|
|
24
23
|
const arrayArgument = Array.isArray(promises);
|
|
25
|
-
|
|
26
24
|
if (arrayArgument) {
|
|
27
25
|
objects = promises;
|
|
28
26
|
} else {
|
|
29
27
|
objects = arguments;
|
|
30
28
|
}
|
|
31
|
-
|
|
32
29
|
let total = objects.length;
|
|
33
30
|
let hadError = false;
|
|
34
31
|
const results = [];
|
|
@@ -36,16 +33,12 @@ function when(promises) {
|
|
|
36
33
|
const errors = [];
|
|
37
34
|
results.length = objects.length;
|
|
38
35
|
errors.length = objects.length;
|
|
39
|
-
|
|
40
36
|
if (total === 0) {
|
|
41
37
|
return Promise.resolve(returnValue);
|
|
42
38
|
}
|
|
43
|
-
|
|
44
39
|
const promise = new resolvingPromise();
|
|
45
|
-
|
|
46
40
|
const resolveOne = function () {
|
|
47
41
|
total--;
|
|
48
|
-
|
|
49
42
|
if (total <= 0) {
|
|
50
43
|
if (hadError) {
|
|
51
44
|
promise.reject(errors);
|
|
@@ -54,7 +47,6 @@ function when(promises) {
|
|
|
54
47
|
}
|
|
55
48
|
}
|
|
56
49
|
};
|
|
57
|
-
|
|
58
50
|
const chain = function (object, index) {
|
|
59
51
|
if (object && typeof object.then === 'function') {
|
|
60
52
|
object.then(function (result) {
|
|
@@ -70,20 +62,16 @@ function when(promises) {
|
|
|
70
62
|
resolveOne();
|
|
71
63
|
}
|
|
72
64
|
};
|
|
73
|
-
|
|
74
65
|
for (let i = 0; i < objects.length; i++) {
|
|
75
66
|
chain(objects[i], i);
|
|
76
67
|
}
|
|
77
|
-
|
|
78
68
|
return promise;
|
|
79
69
|
}
|
|
80
|
-
|
|
81
70
|
function continueWhile(test, emitter) {
|
|
82
71
|
if (test()) {
|
|
83
72
|
return emitter().then(() => {
|
|
84
73
|
return continueWhile(test, emitter);
|
|
85
74
|
});
|
|
86
75
|
}
|
|
87
|
-
|
|
88
76
|
return Promise.resolve();
|
|
89
77
|
}
|
package/lib/node/unique.js
CHANGED
|
@@ -4,35 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = unique;
|
|
7
|
-
|
|
8
7
|
var _arrayContainsObject = _interopRequireDefault(require("./arrayContainsObject"));
|
|
9
|
-
|
|
10
8
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) {
|
|
13
10
|
return obj && obj.__esModule ? obj : {
|
|
14
11
|
default: obj
|
|
15
12
|
};
|
|
16
13
|
}
|
|
17
14
|
/**
|
|
18
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
19
|
-
* All rights reserved.
|
|
20
|
-
*
|
|
21
|
-
* This source code is licensed under the BSD-style license found in the
|
|
22
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
23
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
24
|
-
*
|
|
25
15
|
* @flow
|
|
26
16
|
*/
|
|
27
17
|
|
|
28
|
-
|
|
29
|
-
function unique
|
|
30
|
-
/*:: <T>*/
|
|
31
|
-
(arr
|
|
32
|
-
/*: Array<T>*/
|
|
33
|
-
)
|
|
34
|
-
/*: Array<T>*/
|
|
35
|
-
{
|
|
18
|
+
function unique /*:: <T>*/(arr /*: Array<T>*/) /*: Array<T>*/{
|
|
36
19
|
const uniques = [];
|
|
37
20
|
arr.forEach(value => {
|
|
38
21
|
if (value instanceof _ParseObject.default) {
|