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