parse 3.5.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 +20 -7
- 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 +18 -134
- 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 +73 -302
- package/lib/node/ParseConfig.js +16 -91
- package/lib/node/ParseError.js +61 -74
- package/lib/node/ParseFile.js +55 -244
- 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 +234 -997
- 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 +19 -169
- 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 +37 -30
- package/PATENTS +0 -37
|
@@ -1,33 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
4
|
-
|
|
5
4
|
function _interopRequireDefault(obj) {
|
|
6
5
|
return obj && obj.__esModule ? obj : {
|
|
7
6
|
default: obj
|
|
8
7
|
};
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
12
|
-
* All rights reserved.
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the BSD-style license found in the
|
|
15
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
16
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
17
|
-
*
|
|
18
10
|
* @flow
|
|
19
11
|
* @private
|
|
20
12
|
*/
|
|
21
13
|
|
|
22
|
-
|
|
23
14
|
const StorageController = {
|
|
24
15
|
async: 1,
|
|
25
|
-
|
|
26
|
-
getItemAsync(path
|
|
27
|
-
/*: string*/
|
|
28
|
-
)
|
|
29
|
-
/*: Promise*/
|
|
30
|
-
{
|
|
16
|
+
getItemAsync(path /*: string*/) /*: Promise*/{
|
|
31
17
|
return new Promise((resolve, reject) => {
|
|
32
18
|
_CoreManager.default.getAsyncStorage().getItem(path, (err, value) => {
|
|
33
19
|
if (err) {
|
|
@@ -38,14 +24,7 @@ const StorageController = {
|
|
|
38
24
|
});
|
|
39
25
|
});
|
|
40
26
|
},
|
|
41
|
-
|
|
42
|
-
setItemAsync(path
|
|
43
|
-
/*: string*/
|
|
44
|
-
, value
|
|
45
|
-
/*: string*/
|
|
46
|
-
)
|
|
47
|
-
/*: Promise*/
|
|
48
|
-
{
|
|
27
|
+
setItemAsync(path /*: string*/, value /*: string*/) /*: Promise*/{
|
|
49
28
|
return new Promise((resolve, reject) => {
|
|
50
29
|
_CoreManager.default.getAsyncStorage().setItem(path, value, (err, value) => {
|
|
51
30
|
if (err) {
|
|
@@ -56,12 +35,7 @@ const StorageController = {
|
|
|
56
35
|
});
|
|
57
36
|
});
|
|
58
37
|
},
|
|
59
|
-
|
|
60
|
-
removeItemAsync(path
|
|
61
|
-
/*: string*/
|
|
62
|
-
)
|
|
63
|
-
/*: Promise*/
|
|
64
|
-
{
|
|
38
|
+
removeItemAsync(path /*: string*/) /*: Promise*/{
|
|
65
39
|
return new Promise((resolve, reject) => {
|
|
66
40
|
_CoreManager.default.getAsyncStorage().removeItem(path, err => {
|
|
67
41
|
if (err) {
|
|
@@ -72,10 +46,7 @@ const StorageController = {
|
|
|
72
46
|
});
|
|
73
47
|
});
|
|
74
48
|
},
|
|
75
|
-
|
|
76
|
-
getAllKeysAsync()
|
|
77
|
-
/*: Promise*/
|
|
78
|
-
{
|
|
49
|
+
getAllKeysAsync() /*: Promise*/{
|
|
79
50
|
return new Promise((resolve, reject) => {
|
|
80
51
|
_CoreManager.default.getAsyncStorage().getAllKeys((err, keys) => {
|
|
81
52
|
if (err) {
|
|
@@ -86,12 +57,7 @@ const StorageController = {
|
|
|
86
57
|
});
|
|
87
58
|
});
|
|
88
59
|
},
|
|
89
|
-
|
|
90
|
-
multiGet(keys
|
|
91
|
-
/*: Array<string>*/
|
|
92
|
-
)
|
|
93
|
-
/*: Promise<Array<Array<string>>>*/
|
|
94
|
-
{
|
|
60
|
+
multiGet(keys /*: Array<string>*/) /*: Promise<Array<Array<string>>>*/{
|
|
95
61
|
return new Promise((resolve, reject) => {
|
|
96
62
|
_CoreManager.default.getAsyncStorage().multiGet(keys, (err, result) => {
|
|
97
63
|
if (err) {
|
|
@@ -102,12 +68,7 @@ const StorageController = {
|
|
|
102
68
|
});
|
|
103
69
|
});
|
|
104
70
|
},
|
|
105
|
-
|
|
106
|
-
multiRemove(keys
|
|
107
|
-
/*: Array<string>*/
|
|
108
|
-
)
|
|
109
|
-
/*: Promise*/
|
|
110
|
-
{
|
|
71
|
+
multiRemove(keys /*: Array<string>*/) /*: Promise*/{
|
|
111
72
|
return new Promise((resolve, reject) => {
|
|
112
73
|
_CoreManager.default.getAsyncStorage().multiRemove(keys, err => {
|
|
113
74
|
if (err) {
|
|
@@ -118,10 +79,8 @@ const StorageController = {
|
|
|
118
79
|
});
|
|
119
80
|
});
|
|
120
81
|
},
|
|
121
|
-
|
|
122
82
|
clear() {
|
|
123
83
|
return _CoreManager.default.getAsyncStorage().clear();
|
|
124
84
|
}
|
|
125
|
-
|
|
126
85
|
};
|
|
127
86
|
module.exports = StorageController;
|
|
@@ -1,52 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the BSD-style license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
8
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
9
|
-
*
|
|
10
4
|
* @flow
|
|
11
5
|
* @private
|
|
12
6
|
*/
|
|
13
|
-
|
|
14
7
|
const StorageController = {
|
|
15
8
|
async: 0,
|
|
16
|
-
|
|
17
|
-
getItem(path
|
|
18
|
-
/*: string*/
|
|
19
|
-
)
|
|
20
|
-
/*: ?string*/
|
|
21
|
-
{
|
|
9
|
+
getItem(path /*: string*/) /*: ?string*/{
|
|
22
10
|
return wx.getStorageSync(path);
|
|
23
11
|
},
|
|
24
|
-
|
|
25
|
-
setItem(path
|
|
26
|
-
/*: string*/
|
|
27
|
-
, value
|
|
28
|
-
/*: string*/
|
|
29
|
-
) {
|
|
12
|
+
setItem(path /*: string*/, value /*: string*/) {
|
|
30
13
|
try {
|
|
31
14
|
wx.setStorageSync(path, value);
|
|
32
|
-
} catch (e) {
|
|
15
|
+
} catch (e) {
|
|
16
|
+
// Quota exceeded
|
|
33
17
|
}
|
|
34
18
|
},
|
|
35
|
-
|
|
36
|
-
removeItem(path
|
|
37
|
-
/*: string*/
|
|
38
|
-
) {
|
|
19
|
+
removeItem(path /*: string*/) {
|
|
39
20
|
wx.removeStorageSync(path);
|
|
40
21
|
},
|
|
41
|
-
|
|
42
22
|
getAllKeys() {
|
|
43
23
|
const res = wx.getStorageInfoSync();
|
|
44
24
|
return res.keys;
|
|
45
25
|
},
|
|
46
|
-
|
|
47
26
|
clear() {
|
|
48
27
|
wx.clearStorageSync();
|
|
49
28
|
}
|
|
50
|
-
|
|
51
29
|
};
|
|
52
30
|
module.exports = StorageController;
|
package/lib/node/TaskQueue.js
CHANGED
|
@@ -2,66 +2,43 @@
|
|
|
2
2
|
|
|
3
3
|
var _promiseUtils = require("./promiseUtils");
|
|
4
4
|
/**
|
|
5
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
6
|
-
* All rights reserved.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the BSD-style license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
10
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
11
|
-
*
|
|
12
5
|
* @flow
|
|
13
6
|
*/
|
|
14
7
|
|
|
15
|
-
|
|
16
8
|
class TaskQueue {
|
|
17
9
|
/*:: queue: Array<Task>;*/
|
|
18
10
|
constructor() {
|
|
19
11
|
this.queue = [];
|
|
20
12
|
}
|
|
21
|
-
|
|
22
|
-
enqueue(task
|
|
23
|
-
/*: () => Promise*/
|
|
24
|
-
)
|
|
25
|
-
/*: Promise*/
|
|
26
|
-
{
|
|
13
|
+
enqueue(task /*: () => Promise*/) /*: Promise*/{
|
|
27
14
|
const taskComplete = new _promiseUtils.resolvingPromise();
|
|
28
15
|
this.queue.push({
|
|
29
16
|
task: task,
|
|
30
17
|
_completion: taskComplete
|
|
31
18
|
});
|
|
32
|
-
|
|
33
19
|
if (this.queue.length === 1) {
|
|
34
20
|
task().then(() => {
|
|
35
21
|
this._dequeue();
|
|
36
|
-
|
|
37
22
|
taskComplete.resolve();
|
|
38
23
|
}, error => {
|
|
39
24
|
this._dequeue();
|
|
40
|
-
|
|
41
25
|
taskComplete.reject(error);
|
|
42
26
|
});
|
|
43
27
|
}
|
|
44
|
-
|
|
45
28
|
return taskComplete;
|
|
46
29
|
}
|
|
47
|
-
|
|
48
30
|
_dequeue() {
|
|
49
31
|
this.queue.shift();
|
|
50
|
-
|
|
51
32
|
if (this.queue.length) {
|
|
52
33
|
const next = this.queue[0];
|
|
53
34
|
next.task().then(() => {
|
|
54
35
|
this._dequeue();
|
|
55
|
-
|
|
56
36
|
next._completion.resolve();
|
|
57
37
|
}, error => {
|
|
58
38
|
this._dequeue();
|
|
59
|
-
|
|
60
39
|
next._completion.reject(error);
|
|
61
40
|
});
|
|
62
41
|
}
|
|
63
42
|
}
|
|
64
|
-
|
|
65
43
|
}
|
|
66
|
-
|
|
67
44
|
module.exports = TaskQueue;
|
|
@@ -20,17 +20,13 @@ exports.pushPendingState = pushPendingState;
|
|
|
20
20
|
exports.removeState = removeState;
|
|
21
21
|
exports.setPendingOp = setPendingOp;
|
|
22
22
|
exports.setServerData = setServerData;
|
|
23
|
-
|
|
24
23
|
var ObjectStateMutations = _interopRequireWildcard(require("./ObjectStateMutations"));
|
|
25
|
-
|
|
26
24
|
var _TaskQueue = _interopRequireDefault(require("./TaskQueue"));
|
|
27
|
-
|
|
28
25
|
function _interopRequireDefault(obj) {
|
|
29
26
|
return obj && obj.__esModule ? obj : {
|
|
30
27
|
default: obj
|
|
31
28
|
};
|
|
32
29
|
}
|
|
33
|
-
|
|
34
30
|
function _getRequireWildcardCache(nodeInterop) {
|
|
35
31
|
if (typeof WeakMap !== "function") return null;
|
|
36
32
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -39,31 +35,24 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
39
35
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
40
36
|
})(nodeInterop);
|
|
41
37
|
}
|
|
42
|
-
|
|
43
38
|
function _interopRequireWildcard(obj, nodeInterop) {
|
|
44
39
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
45
40
|
return obj;
|
|
46
41
|
}
|
|
47
|
-
|
|
48
42
|
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
49
43
|
return {
|
|
50
44
|
default: obj
|
|
51
45
|
};
|
|
52
46
|
}
|
|
53
|
-
|
|
54
47
|
var cache = _getRequireWildcardCache(nodeInterop);
|
|
55
|
-
|
|
56
48
|
if (cache && cache.has(obj)) {
|
|
57
49
|
return cache.get(obj);
|
|
58
50
|
}
|
|
59
|
-
|
|
60
51
|
var newObj = {};
|
|
61
52
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
62
|
-
|
|
63
53
|
for (var key in obj) {
|
|
64
54
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
65
55
|
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
66
|
-
|
|
67
56
|
if (desc && (desc.get || desc.set)) {
|
|
68
57
|
Object.defineProperty(newObj, key, desc);
|
|
69
58
|
} else {
|
|
@@ -71,51 +60,26 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
71
60
|
}
|
|
72
61
|
}
|
|
73
62
|
}
|
|
74
|
-
|
|
75
63
|
newObj.default = obj;
|
|
76
|
-
|
|
77
64
|
if (cache) {
|
|
78
65
|
cache.set(obj, newObj);
|
|
79
66
|
}
|
|
80
|
-
|
|
81
67
|
return newObj;
|
|
82
68
|
}
|
|
83
69
|
/**
|
|
84
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
85
|
-
* All rights reserved.
|
|
86
|
-
*
|
|
87
|
-
* This source code is licensed under the BSD-style license found in the
|
|
88
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
89
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
90
|
-
*
|
|
91
70
|
* @flow
|
|
92
71
|
*/
|
|
93
72
|
|
|
94
|
-
|
|
95
73
|
let objectState = new WeakMap();
|
|
96
|
-
|
|
97
|
-
function getState(obj
|
|
98
|
-
/*: ParseObject*/
|
|
99
|
-
)
|
|
100
|
-
/*: ?State*/
|
|
101
|
-
{
|
|
74
|
+
function getState(obj /*: ParseObject*/) /*: ?State*/{
|
|
102
75
|
const classData = objectState.get(obj);
|
|
103
76
|
return classData || null;
|
|
104
77
|
}
|
|
105
|
-
|
|
106
|
-
function initializeState(obj
|
|
107
|
-
/*: ParseObject*/
|
|
108
|
-
, initial
|
|
109
|
-
/*:: ?: State*/
|
|
110
|
-
)
|
|
111
|
-
/*: State*/
|
|
112
|
-
{
|
|
78
|
+
function initializeState(obj /*: ParseObject*/, initial /*:: ?: State*/) /*: State*/{
|
|
113
79
|
let state = getState(obj);
|
|
114
|
-
|
|
115
80
|
if (state) {
|
|
116
81
|
return state;
|
|
117
82
|
}
|
|
118
|
-
|
|
119
83
|
if (!initial) {
|
|
120
84
|
initial = {
|
|
121
85
|
serverData: {},
|
|
@@ -125,181 +89,93 @@ function initializeState(obj
|
|
|
125
89
|
existed: false
|
|
126
90
|
};
|
|
127
91
|
}
|
|
128
|
-
|
|
129
92
|
state = initial;
|
|
130
93
|
objectState.set(obj, state);
|
|
131
94
|
return state;
|
|
132
95
|
}
|
|
133
|
-
|
|
134
|
-
function removeState(obj
|
|
135
|
-
/*: ParseObject*/
|
|
136
|
-
)
|
|
137
|
-
/*: ?State*/
|
|
138
|
-
{
|
|
96
|
+
function removeState(obj /*: ParseObject*/) /*: ?State*/{
|
|
139
97
|
const state = getState(obj);
|
|
140
|
-
|
|
141
98
|
if (state === null) {
|
|
142
99
|
return null;
|
|
143
100
|
}
|
|
144
|
-
|
|
145
101
|
objectState.delete(obj);
|
|
146
102
|
return state;
|
|
147
103
|
}
|
|
148
|
-
|
|
149
|
-
function getServerData(obj
|
|
150
|
-
/*: ParseObject*/
|
|
151
|
-
)
|
|
152
|
-
/*: AttributeMap*/
|
|
153
|
-
{
|
|
104
|
+
function getServerData(obj /*: ParseObject*/) /*: AttributeMap*/{
|
|
154
105
|
const state = getState(obj);
|
|
155
|
-
|
|
156
106
|
if (state) {
|
|
157
107
|
return state.serverData;
|
|
158
108
|
}
|
|
159
|
-
|
|
160
109
|
return {};
|
|
161
110
|
}
|
|
162
|
-
|
|
163
|
-
function setServerData(obj
|
|
164
|
-
/*: ParseObject*/
|
|
165
|
-
, attributes
|
|
166
|
-
/*: AttributeMap*/
|
|
167
|
-
) {
|
|
111
|
+
function setServerData(obj /*: ParseObject*/, attributes /*: AttributeMap*/) {
|
|
168
112
|
const serverData = initializeState(obj).serverData;
|
|
169
113
|
ObjectStateMutations.setServerData(serverData, attributes);
|
|
170
114
|
}
|
|
171
|
-
|
|
172
|
-
function getPendingOps(obj
|
|
173
|
-
/*: ParseObject*/
|
|
174
|
-
)
|
|
175
|
-
/*: Array<OpsMap>*/
|
|
176
|
-
{
|
|
115
|
+
function getPendingOps(obj /*: ParseObject*/) /*: Array<OpsMap>*/{
|
|
177
116
|
const state = getState(obj);
|
|
178
|
-
|
|
179
117
|
if (state) {
|
|
180
118
|
return state.pendingOps;
|
|
181
119
|
}
|
|
182
|
-
|
|
183
120
|
return [{}];
|
|
184
121
|
}
|
|
185
|
-
|
|
186
|
-
function setPendingOp(obj
|
|
187
|
-
/*: ParseObject*/
|
|
188
|
-
, attr
|
|
189
|
-
/*: string*/
|
|
190
|
-
, op
|
|
191
|
-
/*: ?Op*/
|
|
192
|
-
) {
|
|
122
|
+
function setPendingOp(obj /*: ParseObject*/, attr /*: string*/, op /*: ?Op*/) {
|
|
193
123
|
const pendingOps = initializeState(obj).pendingOps;
|
|
194
124
|
ObjectStateMutations.setPendingOp(pendingOps, attr, op);
|
|
195
125
|
}
|
|
196
|
-
|
|
197
|
-
function pushPendingState(obj
|
|
198
|
-
/*: ParseObject*/
|
|
199
|
-
) {
|
|
126
|
+
function pushPendingState(obj /*: ParseObject*/) {
|
|
200
127
|
const pendingOps = initializeState(obj).pendingOps;
|
|
201
128
|
ObjectStateMutations.pushPendingState(pendingOps);
|
|
202
129
|
}
|
|
203
|
-
|
|
204
|
-
function popPendingState(obj
|
|
205
|
-
/*: ParseObject*/
|
|
206
|
-
)
|
|
207
|
-
/*: OpsMap*/
|
|
208
|
-
{
|
|
130
|
+
function popPendingState(obj /*: ParseObject*/) /*: OpsMap*/{
|
|
209
131
|
const pendingOps = initializeState(obj).pendingOps;
|
|
210
132
|
return ObjectStateMutations.popPendingState(pendingOps);
|
|
211
133
|
}
|
|
212
|
-
|
|
213
|
-
function mergeFirstPendingState(obj
|
|
214
|
-
/*: ParseObject*/
|
|
215
|
-
) {
|
|
134
|
+
function mergeFirstPendingState(obj /*: ParseObject*/) {
|
|
216
135
|
const pendingOps = getPendingOps(obj);
|
|
217
136
|
ObjectStateMutations.mergeFirstPendingState(pendingOps);
|
|
218
137
|
}
|
|
219
|
-
|
|
220
|
-
function getObjectCache(obj
|
|
221
|
-
/*: ParseObject*/
|
|
222
|
-
)
|
|
223
|
-
/*: ObjectCache*/
|
|
224
|
-
{
|
|
138
|
+
function getObjectCache(obj /*: ParseObject*/) /*: ObjectCache*/{
|
|
225
139
|
const state = getState(obj);
|
|
226
|
-
|
|
227
140
|
if (state) {
|
|
228
141
|
return state.objectCache;
|
|
229
142
|
}
|
|
230
|
-
|
|
231
143
|
return {};
|
|
232
144
|
}
|
|
233
|
-
|
|
234
|
-
function estimateAttribute(obj
|
|
235
|
-
/*: ParseObject*/
|
|
236
|
-
, attr
|
|
237
|
-
/*: string*/
|
|
238
|
-
)
|
|
239
|
-
/*: mixed*/
|
|
240
|
-
{
|
|
145
|
+
function estimateAttribute(obj /*: ParseObject*/, attr /*: string*/) /*: mixed*/{
|
|
241
146
|
const serverData = getServerData(obj);
|
|
242
147
|
const pendingOps = getPendingOps(obj);
|
|
243
148
|
return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj.className, obj.id, attr);
|
|
244
149
|
}
|
|
245
|
-
|
|
246
|
-
function estimateAttributes(obj
|
|
247
|
-
/*: ParseObject*/
|
|
248
|
-
)
|
|
249
|
-
/*: AttributeMap*/
|
|
250
|
-
{
|
|
150
|
+
function estimateAttributes(obj /*: ParseObject*/) /*: AttributeMap*/{
|
|
251
151
|
const serverData = getServerData(obj);
|
|
252
152
|
const pendingOps = getPendingOps(obj);
|
|
253
153
|
return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj.className, obj.id);
|
|
254
154
|
}
|
|
255
|
-
|
|
256
|
-
function commitServerChanges(obj
|
|
257
|
-
/*: ParseObject*/
|
|
258
|
-
, changes
|
|
259
|
-
/*: AttributeMap*/
|
|
260
|
-
) {
|
|
155
|
+
function commitServerChanges(obj /*: ParseObject*/, changes /*: AttributeMap*/) {
|
|
261
156
|
const state = initializeState(obj);
|
|
262
157
|
ObjectStateMutations.commitServerChanges(state.serverData, state.objectCache, changes);
|
|
263
158
|
}
|
|
264
|
-
|
|
265
|
-
function enqueueTask(obj
|
|
266
|
-
/*: ParseObject*/
|
|
267
|
-
, task
|
|
268
|
-
/*: () => Promise*/
|
|
269
|
-
)
|
|
270
|
-
/*: Promise*/
|
|
271
|
-
{
|
|
159
|
+
function enqueueTask(obj /*: ParseObject*/, task /*: () => Promise*/) /*: Promise*/{
|
|
272
160
|
const state = initializeState(obj);
|
|
273
161
|
return state.tasks.enqueue(task);
|
|
274
162
|
}
|
|
275
|
-
|
|
276
|
-
function duplicateState(source
|
|
277
|
-
/*: ParseObject*/
|
|
278
|
-
, dest
|
|
279
|
-
/*: ParseObject*/
|
|
280
|
-
)
|
|
281
|
-
/*: void*/
|
|
282
|
-
{
|
|
163
|
+
function duplicateState(source /*: ParseObject*/, dest /*: ParseObject*/) /*: void*/{
|
|
283
164
|
const oldState = initializeState(source);
|
|
284
165
|
const newState = initializeState(dest);
|
|
285
|
-
|
|
286
166
|
for (const key in oldState.serverData) {
|
|
287
167
|
newState.serverData[key] = oldState.serverData[key];
|
|
288
168
|
}
|
|
289
|
-
|
|
290
169
|
for (let index = 0; index < oldState.pendingOps.length; index++) {
|
|
291
170
|
for (const key in oldState.pendingOps[index]) {
|
|
292
171
|
newState.pendingOps[index][key] = oldState.pendingOps[index][key];
|
|
293
172
|
}
|
|
294
173
|
}
|
|
295
|
-
|
|
296
174
|
for (const key in oldState.objectCache) {
|
|
297
175
|
newState.objectCache[key] = oldState.objectCache[key];
|
|
298
176
|
}
|
|
299
|
-
|
|
300
177
|
newState.existed = oldState.existed;
|
|
301
178
|
}
|
|
302
|
-
|
|
303
179
|
function clearAllState() {
|
|
304
180
|
objectState = new WeakMap();
|
|
305
181
|
}
|
package/lib/node/Xhr.weapp.js
CHANGED
|
@@ -16,53 +16,39 @@ module.exports = class {
|
|
|
16
16
|
this.responseHeader = {};
|
|
17
17
|
this.method = '';
|
|
18
18
|
this.url = '';
|
|
19
|
-
|
|
20
19
|
this.onabort = () => {};
|
|
21
|
-
|
|
22
20
|
this.onprogress = () => {};
|
|
23
|
-
|
|
24
21
|
this.onerror = () => {};
|
|
25
|
-
|
|
26
22
|
this.onreadystatechange = () => {};
|
|
27
|
-
|
|
28
23
|
this.requestTask = null;
|
|
29
24
|
}
|
|
30
|
-
|
|
31
25
|
getAllResponseHeaders() {
|
|
32
26
|
let header = '';
|
|
33
|
-
|
|
34
27
|
for (const key in this.responseHeader) {
|
|
35
28
|
header += key + ':' + this.getResponseHeader(key) + '\r\n';
|
|
36
29
|
}
|
|
37
|
-
|
|
38
30
|
return header;
|
|
39
31
|
}
|
|
40
|
-
|
|
41
32
|
getResponseHeader(key) {
|
|
42
33
|
return this.responseHeader[key];
|
|
43
34
|
}
|
|
44
|
-
|
|
45
35
|
setRequestHeader(key, value) {
|
|
46
36
|
this.header[key] = value;
|
|
47
37
|
}
|
|
48
|
-
|
|
49
38
|
open(method, url) {
|
|
50
39
|
this.method = method;
|
|
51
40
|
this.url = url;
|
|
52
41
|
}
|
|
53
|
-
|
|
54
42
|
abort() {
|
|
55
43
|
if (!this.requestTask) {
|
|
56
44
|
return;
|
|
57
45
|
}
|
|
58
|
-
|
|
59
46
|
this.requestTask.abort();
|
|
60
47
|
this.status = 0;
|
|
61
48
|
this.response = undefined;
|
|
62
49
|
this.onabort();
|
|
63
50
|
this.onreadystatechange();
|
|
64
51
|
}
|
|
65
|
-
|
|
66
52
|
send(data) {
|
|
67
53
|
this.requestTask = wx.request({
|
|
68
54
|
url: this.url,
|
|
@@ -92,5 +78,4 @@ module.exports = class {
|
|
|
92
78
|
this.onprogress(event);
|
|
93
79
|
});
|
|
94
80
|
}
|
|
95
|
-
|
|
96
81
|
};
|
|
@@ -4,42 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = arrayContainsObject;
|
|
7
|
-
|
|
8
7
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) {
|
|
11
9
|
return obj && obj.__esModule ? obj : {
|
|
12
10
|
default: obj
|
|
13
11
|
};
|
|
14
12
|
}
|
|
15
13
|
/**
|
|
16
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
17
|
-
* All rights reserved.
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the BSD-style license found in the
|
|
20
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
21
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
22
|
-
*
|
|
23
14
|
* @flow
|
|
24
15
|
*/
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
function arrayContainsObject(array
|
|
28
|
-
/*: Array<any>*/
|
|
29
|
-
, object
|
|
30
|
-
/*: ParseObject*/
|
|
31
|
-
)
|
|
32
|
-
/*: boolean*/
|
|
33
|
-
{
|
|
17
|
+
function arrayContainsObject(array /*: Array<any>*/, object /*: ParseObject*/) /*: boolean*/{
|
|
34
18
|
if (array.indexOf(object) > -1) {
|
|
35
19
|
return true;
|
|
36
20
|
}
|
|
37
|
-
|
|
38
21
|
for (let i = 0; i < array.length; i++) {
|
|
39
22
|
if (array[i] instanceof _ParseObject.default && array[i].className === object.className && array[i]._getId() === object._getId()) {
|
|
40
23
|
return true;
|
|
41
24
|
}
|
|
42
25
|
}
|
|
43
|
-
|
|
44
26
|
return false;
|
|
45
27
|
}
|