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,439 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _reverseInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/reverse");
|
|
6
|
-
|
|
7
|
-
var _Promise2 = require("@babel/runtime-corejs3/core-js-stable/promise");
|
|
8
|
-
|
|
9
|
-
var _Object$setPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
|
|
10
|
-
|
|
11
|
-
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
|
12
|
-
|
|
13
|
-
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
14
|
-
|
|
15
|
-
var _Object$getPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
|
|
16
|
-
|
|
17
|
-
var _Object$create = require("@babel/runtime-corejs3/core-js-stable/object/create");
|
|
18
|
-
|
|
19
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
20
|
-
|
|
21
|
-
var _Array$isArray2 = require("@babel/runtime-corejs3/core-js-stable/array/is-array");
|
|
22
|
-
|
|
23
|
-
var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
|
|
24
|
-
|
|
25
|
-
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
|
26
|
-
|
|
27
|
-
var _Array$from2 = require("@babel/runtime-corejs3/core-js-stable/array/from");
|
|
28
|
-
|
|
29
3
|
var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
36
|
-
|
|
37
|
-
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
38
|
-
|
|
4
|
+
var _Array$from2 = require("@babel/runtime-corejs3/core-js-stable/array/from");
|
|
5
|
+
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
|
6
|
+
var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
|
|
7
|
+
var _Array$isArray2 = require("@babel/runtime-corejs3/core-js-stable/array/is-array");
|
|
8
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
39
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
|
40
|
-
|
|
41
|
-
var _keys2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/keys"));
|
|
42
|
-
|
|
43
|
-
var _startsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/starts-with"));
|
|
44
|
-
|
|
45
|
-
var _keys3 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
46
|
-
|
|
47
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
48
|
-
|
|
49
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
50
|
-
|
|
51
|
-
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
52
|
-
|
|
10
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
53
11
|
var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
|
|
54
|
-
|
|
12
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
13
|
+
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
14
|
+
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
15
|
+
var _keys2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
16
|
+
var _startsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/starts-with"));
|
|
17
|
+
var _keys3 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/keys"));
|
|
18
|
+
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
19
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
20
|
+
var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
|
|
21
|
+
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
55
22
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/toConsumableArray"));
|
|
56
|
-
|
|
57
|
-
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
58
|
-
|
|
59
23
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
|
60
|
-
|
|
61
24
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
62
|
-
|
|
63
25
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
64
|
-
|
|
65
26
|
var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
66
|
-
|
|
67
27
|
var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
|
|
68
|
-
|
|
69
|
-
function _regeneratorRuntime() {
|
|
70
|
-
"use strict";
|
|
71
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
72
|
-
|
|
73
|
-
_regeneratorRuntime = function () {
|
|
74
|
-
return exports;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
var exports = {},
|
|
78
|
-
Op = Object.prototype,
|
|
79
|
-
hasOwn = Op.hasOwnProperty,
|
|
80
|
-
$Symbol = "function" == typeof _Symbol ? _Symbol : {},
|
|
81
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
82
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
83
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
84
|
-
|
|
85
|
-
function define(obj, key, value) {
|
|
86
|
-
return _Object$defineProperty(obj, key, {
|
|
87
|
-
value: value,
|
|
88
|
-
enumerable: !0,
|
|
89
|
-
configurable: !0,
|
|
90
|
-
writable: !0
|
|
91
|
-
}), obj[key];
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
try {
|
|
95
|
-
define({}, "");
|
|
96
|
-
} catch (err) {
|
|
97
|
-
define = function (obj, key, value) {
|
|
98
|
-
return obj[key] = value;
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
103
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
104
|
-
generator = _Object$create(protoGenerator.prototype),
|
|
105
|
-
context = new Context(tryLocsList || []);
|
|
106
|
-
|
|
107
|
-
return generator._invoke = function (innerFn, self, context) {
|
|
108
|
-
var state = "suspendedStart";
|
|
109
|
-
return function (method, arg) {
|
|
110
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
111
|
-
|
|
112
|
-
if ("completed" === state) {
|
|
113
|
-
if ("throw" === method) throw arg;
|
|
114
|
-
return doneResult();
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
for (context.method = method, context.arg = arg;;) {
|
|
118
|
-
var delegate = context.delegate;
|
|
119
|
-
|
|
120
|
-
if (delegate) {
|
|
121
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
122
|
-
|
|
123
|
-
if (delegateResult) {
|
|
124
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
125
|
-
return delegateResult;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
130
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
131
|
-
context.dispatchException(context.arg);
|
|
132
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
133
|
-
state = "executing";
|
|
134
|
-
var record = tryCatch(innerFn, self, context);
|
|
135
|
-
|
|
136
|
-
if ("normal" === record.type) {
|
|
137
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
138
|
-
return {
|
|
139
|
-
value: record.arg,
|
|
140
|
-
done: context.done
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
}(innerFn, self, context), generator;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function tryCatch(fn, obj, arg) {
|
|
151
|
-
try {
|
|
152
|
-
return {
|
|
153
|
-
type: "normal",
|
|
154
|
-
arg: fn.call(obj, arg)
|
|
155
|
-
};
|
|
156
|
-
} catch (err) {
|
|
157
|
-
return {
|
|
158
|
-
type: "throw",
|
|
159
|
-
arg: err
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
exports.wrap = wrap;
|
|
165
|
-
var ContinueSentinel = {};
|
|
166
|
-
|
|
167
|
-
function Generator() {}
|
|
168
|
-
|
|
169
|
-
function GeneratorFunction() {}
|
|
170
|
-
|
|
171
|
-
function GeneratorFunctionPrototype() {}
|
|
172
|
-
|
|
173
|
-
var IteratorPrototype = {};
|
|
174
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
175
|
-
return this;
|
|
176
|
-
});
|
|
177
|
-
var getProto = _Object$getPrototypeOf,
|
|
178
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
179
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
180
|
-
|
|
181
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
|
|
182
|
-
|
|
183
|
-
function defineIteratorMethods(prototype) {
|
|
184
|
-
var _context19;
|
|
185
|
-
|
|
186
|
-
_forEachInstanceProperty(_context19 = ["next", "throw", "return"]).call(_context19, function (method) {
|
|
187
|
-
define(prototype, method, function (arg) {
|
|
188
|
-
return this._invoke(method, arg);
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
194
|
-
function invoke(method, arg, resolve, reject) {
|
|
195
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
196
|
-
|
|
197
|
-
if ("throw" !== record.type) {
|
|
198
|
-
var result = record.arg,
|
|
199
|
-
value = result.value;
|
|
200
|
-
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
201
|
-
invoke("next", value, resolve, reject);
|
|
202
|
-
}, function (err) {
|
|
203
|
-
invoke("throw", err, resolve, reject);
|
|
204
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
205
|
-
result.value = unwrapped, resolve(result);
|
|
206
|
-
}, function (error) {
|
|
207
|
-
return invoke("throw", error, resolve, reject);
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
reject(record.arg);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
var previousPromise;
|
|
215
|
-
|
|
216
|
-
this._invoke = function (method, arg) {
|
|
217
|
-
function callInvokeWithMethodAndArg() {
|
|
218
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
219
|
-
invoke(method, arg, resolve, reject);
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
228
|
-
var method = delegate.iterator[context.method];
|
|
229
|
-
|
|
230
|
-
if (undefined === method) {
|
|
231
|
-
if (context.delegate = null, "throw" === context.method) {
|
|
232
|
-
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
233
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return ContinueSentinel;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
240
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
241
|
-
var info = record.arg;
|
|
242
|
-
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function pushTryEntry(locs) {
|
|
246
|
-
var entry = {
|
|
247
|
-
tryLoc: locs[0]
|
|
248
|
-
};
|
|
249
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
function resetTryEntry(entry) {
|
|
253
|
-
var record = entry.completion || {};
|
|
254
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function Context(tryLocsList) {
|
|
258
|
-
this.tryEntries = [{
|
|
259
|
-
tryLoc: "root"
|
|
260
|
-
}], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function values(iterable) {
|
|
264
|
-
if (iterable) {
|
|
265
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
266
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
267
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
268
|
-
|
|
269
|
-
if (!isNaN(iterable.length)) {
|
|
270
|
-
var i = -1,
|
|
271
|
-
next = function next() {
|
|
272
|
-
for (; ++i < iterable.length;) {
|
|
273
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return next.value = undefined, next.done = !0, next;
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
return next.next = next;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
return {
|
|
284
|
-
next: doneResult
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
function doneResult() {
|
|
289
|
-
return {
|
|
290
|
-
value: undefined,
|
|
291
|
-
done: !0
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
296
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
297
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
298
|
-
}, exports.mark = function (genFun) {
|
|
299
|
-
return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
|
|
300
|
-
}, exports.awrap = function (arg) {
|
|
301
|
-
return {
|
|
302
|
-
__await: arg
|
|
303
|
-
};
|
|
304
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
305
|
-
return this;
|
|
306
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
307
|
-
void 0 === PromiseImpl && (PromiseImpl = _Promise2);
|
|
308
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
309
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
310
|
-
return result.done ? result.value : iter.next();
|
|
311
|
-
});
|
|
312
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
313
|
-
return this;
|
|
314
|
-
}), define(Gp, "toString", function () {
|
|
315
|
-
return "[object Generator]";
|
|
316
|
-
}), exports.keys = function (object) {
|
|
317
|
-
var keys = [];
|
|
318
|
-
|
|
319
|
-
for (var key in object) {
|
|
320
|
-
keys.push(key);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
return _reverseInstanceProperty(keys).call(keys), function next() {
|
|
324
|
-
for (; keys.length;) {
|
|
325
|
-
var key = keys.pop();
|
|
326
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
return next.done = !0, next;
|
|
330
|
-
};
|
|
331
|
-
}, exports.values = values, Context.prototype = {
|
|
332
|
-
constructor: Context,
|
|
333
|
-
reset: function (skipTempReset) {
|
|
334
|
-
var _context20;
|
|
335
|
-
|
|
336
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context20 = this.tryEntries).call(_context20, resetTryEntry), !skipTempReset) for (var name in this) {
|
|
337
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
|
|
338
|
-
}
|
|
339
|
-
},
|
|
340
|
-
stop: function () {
|
|
341
|
-
this.done = !0;
|
|
342
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
343
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
344
|
-
return this.rval;
|
|
345
|
-
},
|
|
346
|
-
dispatchException: function (exception) {
|
|
347
|
-
if (this.done) throw exception;
|
|
348
|
-
var context = this;
|
|
349
|
-
|
|
350
|
-
function handle(loc, caught) {
|
|
351
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
355
|
-
var entry = this.tryEntries[i],
|
|
356
|
-
record = entry.completion;
|
|
357
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
358
|
-
|
|
359
|
-
if (entry.tryLoc <= this.prev) {
|
|
360
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
361
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
362
|
-
|
|
363
|
-
if (hasCatch && hasFinally) {
|
|
364
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
365
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
366
|
-
} else if (hasCatch) {
|
|
367
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
368
|
-
} else {
|
|
369
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
370
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
},
|
|
375
|
-
abrupt: function (type, arg) {
|
|
376
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
377
|
-
var entry = this.tryEntries[i];
|
|
378
|
-
|
|
379
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
380
|
-
var finallyEntry = entry;
|
|
381
|
-
break;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
386
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
387
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
388
|
-
},
|
|
389
|
-
complete: function (record, afterLoc) {
|
|
390
|
-
if ("throw" === record.type) throw record.arg;
|
|
391
|
-
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
392
|
-
},
|
|
393
|
-
finish: function (finallyLoc) {
|
|
394
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
395
|
-
var entry = this.tryEntries[i];
|
|
396
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
397
|
-
}
|
|
398
|
-
},
|
|
399
|
-
catch: function (tryLoc) {
|
|
400
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
401
|
-
var entry = this.tryEntries[i];
|
|
402
|
-
|
|
403
|
-
if (entry.tryLoc === tryLoc) {
|
|
404
|
-
var record = entry.completion;
|
|
405
|
-
|
|
406
|
-
if ("throw" === record.type) {
|
|
407
|
-
var thrown = record.arg;
|
|
408
|
-
resetTryEntry(entry);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
return thrown;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
throw new Error("illegal catch attempt");
|
|
416
|
-
},
|
|
417
|
-
delegateYield: function (iterable, resultName, nextLoc) {
|
|
418
|
-
return this.delegate = {
|
|
419
|
-
iterator: values(iterable),
|
|
420
|
-
resultName: resultName,
|
|
421
|
-
nextLoc: nextLoc
|
|
422
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
423
|
-
}
|
|
424
|
-
}, exports;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
28
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
428
29
|
var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
|
|
429
|
-
|
|
430
30
|
if (!it) {
|
|
431
31
|
if (_Array$isArray2(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
432
32
|
if (it) o = it;
|
|
433
33
|
var i = 0;
|
|
434
|
-
|
|
435
34
|
var F = function () {};
|
|
436
|
-
|
|
437
35
|
return {
|
|
438
36
|
s: F,
|
|
439
37
|
n: function () {
|
|
@@ -451,13 +49,11 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
451
49
|
f: F
|
|
452
50
|
};
|
|
453
51
|
}
|
|
454
|
-
|
|
455
52
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
456
53
|
}
|
|
457
|
-
|
|
458
54
|
var normalCompletion = true,
|
|
459
|
-
|
|
460
|
-
|
|
55
|
+
didErr = false,
|
|
56
|
+
err;
|
|
461
57
|
return {
|
|
462
58
|
s: function () {
|
|
463
59
|
it = it.call(o);
|
|
@@ -480,27 +76,18 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
480
76
|
}
|
|
481
77
|
};
|
|
482
78
|
}
|
|
483
|
-
|
|
484
79
|
function _unsupportedIterableToArray(o, minLen) {
|
|
485
|
-
var
|
|
486
|
-
|
|
80
|
+
var _context16;
|
|
487
81
|
if (!o) return;
|
|
488
82
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
489
|
-
|
|
490
|
-
var n = _sliceInstanceProperty(_context18 = Object.prototype.toString.call(o)).call(_context18, 8, -1);
|
|
491
|
-
|
|
83
|
+
var n = _sliceInstanceProperty(_context16 = Object.prototype.toString.call(o)).call(_context16, 8, -1);
|
|
492
84
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
493
85
|
if (n === "Map" || n === "Set") return _Array$from2(o);
|
|
494
86
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
495
87
|
}
|
|
496
|
-
|
|
497
88
|
function _arrayLikeToArray(arr, len) {
|
|
498
89
|
if (len == null || len > arr.length) len = arr.length;
|
|
499
|
-
|
|
500
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
501
|
-
arr2[i] = arr[i];
|
|
502
|
-
}
|
|
503
|
-
|
|
90
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
504
91
|
return arr2;
|
|
505
92
|
}
|
|
506
93
|
/**
|
|
@@ -523,371 +110,261 @@ function _arrayLikeToArray(arr, len) {
|
|
|
523
110
|
* @class Parse.LocalDatastore
|
|
524
111
|
* @static
|
|
525
112
|
*/
|
|
526
|
-
|
|
527
|
-
|
|
528
113
|
var LocalDatastore = {
|
|
529
114
|
isEnabled: false,
|
|
530
115
|
isSyncing: false,
|
|
531
|
-
fromPinWithName: function (name
|
|
532
|
-
/*: string*/
|
|
533
|
-
)
|
|
534
|
-
/*: Promise<Array<Object>>*/
|
|
535
|
-
{
|
|
116
|
+
fromPinWithName: function (name /*: string*/) /*: Promise<Array<Object>>*/{
|
|
536
117
|
var controller = _CoreManager.default.getLocalDatastoreController();
|
|
537
|
-
|
|
538
118
|
return controller.fromPinWithName(name);
|
|
539
119
|
},
|
|
540
|
-
pinWithName: function (name
|
|
541
|
-
/*: string*/
|
|
542
|
-
, value
|
|
543
|
-
/*: any*/
|
|
544
|
-
)
|
|
545
|
-
/*: Promise<void>*/
|
|
546
|
-
{
|
|
120
|
+
pinWithName: function (name /*: string*/, value /*: any*/) /*: Promise<void>*/{
|
|
547
121
|
var controller = _CoreManager.default.getLocalDatastoreController();
|
|
548
|
-
|
|
549
122
|
return controller.pinWithName(name, value);
|
|
550
123
|
},
|
|
551
|
-
unPinWithName: function (name
|
|
552
|
-
/*: string*/
|
|
553
|
-
)
|
|
554
|
-
/*: Promise<void>*/
|
|
555
|
-
{
|
|
124
|
+
unPinWithName: function (name /*: string*/) /*: Promise<void>*/{
|
|
556
125
|
var controller = _CoreManager.default.getLocalDatastoreController();
|
|
557
|
-
|
|
558
126
|
return controller.unPinWithName(name);
|
|
559
127
|
},
|
|
560
|
-
_getAllContents: function ()
|
|
561
|
-
/*: Promise<Object>*/
|
|
562
|
-
{
|
|
128
|
+
_getAllContents: function () /*: Promise<Object>*/{
|
|
563
129
|
var controller = _CoreManager.default.getLocalDatastoreController();
|
|
564
|
-
|
|
565
130
|
return controller.getAllContents();
|
|
566
131
|
},
|
|
567
132
|
// Use for testing
|
|
568
|
-
_getRawStorage: function ()
|
|
569
|
-
/*: Promise<Object>*/
|
|
570
|
-
{
|
|
133
|
+
_getRawStorage: function () /*: Promise<Object>*/{
|
|
571
134
|
var controller = _CoreManager.default.getLocalDatastoreController();
|
|
572
|
-
|
|
573
135
|
return controller.getRawStorage();
|
|
574
136
|
},
|
|
575
|
-
_clear: function ()
|
|
576
|
-
/*: Promise<void>*/
|
|
577
|
-
{
|
|
137
|
+
_clear: function () /*: Promise<void>*/{
|
|
578
138
|
var controller = _CoreManager.default.getLocalDatastoreController();
|
|
579
|
-
|
|
580
139
|
return controller.clear();
|
|
581
140
|
},
|
|
582
141
|
// Pin the object and children recursively
|
|
583
142
|
// Saves the object and children key to Pin Name
|
|
584
|
-
_handlePinAllWithName: function (name
|
|
585
|
-
/*: string*/
|
|
586
|
-
, objects
|
|
587
|
-
/*: Array<ParseObject>*/
|
|
588
|
-
)
|
|
589
|
-
/*: Promise<void>*/
|
|
590
|
-
{
|
|
143
|
+
_handlePinAllWithName: function (name /*: string*/, objects /*: Array<ParseObject>*/) /*: Promise<void>*/{
|
|
591
144
|
var _this = this;
|
|
592
|
-
|
|
593
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
145
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
594
146
|
var _context;
|
|
595
|
-
|
|
596
147
|
var pinName, toPinPromises, objectKeys, _iterator, _step, parent, children, parentKey, json, objectKey, fromPinPromise, _yield$Promise$all, _yield$Promise$all2, pinned, toPin;
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
_iterator =
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
children[parentKey] = json;
|
|
619
|
-
|
|
620
|
-
for (objectKey in children) {
|
|
621
|
-
objectKeys.push(objectKey);
|
|
622
|
-
toPinPromises.push(_this.pinWithName(objectKey, [children[objectKey]]));
|
|
623
|
-
}
|
|
148
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
149
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
150
|
+
case 0:
|
|
151
|
+
pinName = _this.getPinName(name);
|
|
152
|
+
toPinPromises = [];
|
|
153
|
+
objectKeys = [];
|
|
154
|
+
_iterator = _createForOfIteratorHelper(objects);
|
|
155
|
+
try {
|
|
156
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
157
|
+
parent = _step.value;
|
|
158
|
+
children = _this._getChildren(parent);
|
|
159
|
+
parentKey = _this.getKeyForObject(parent);
|
|
160
|
+
json = parent._toFullJSON(undefined, true);
|
|
161
|
+
if (parent._localId) {
|
|
162
|
+
json._localId = parent._localId;
|
|
163
|
+
}
|
|
164
|
+
children[parentKey] = json;
|
|
165
|
+
for (objectKey in children) {
|
|
166
|
+
objectKeys.push(objectKey);
|
|
167
|
+
toPinPromises.push(_this.pinWithName(objectKey, [children[objectKey]]));
|
|
624
168
|
}
|
|
625
|
-
} catch (err) {
|
|
626
|
-
_iterator.e(err);
|
|
627
|
-
} finally {
|
|
628
|
-
_iterator.f();
|
|
629
169
|
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
170
|
+
} catch (err) {
|
|
171
|
+
_iterator.e(err);
|
|
172
|
+
} finally {
|
|
173
|
+
_iterator.f();
|
|
174
|
+
}
|
|
175
|
+
fromPinPromise = _this.fromPinWithName(pinName);
|
|
176
|
+
_context2.next = 8;
|
|
177
|
+
return _promise.default.all([fromPinPromise, toPinPromises]);
|
|
178
|
+
case 8:
|
|
179
|
+
_yield$Promise$all = _context2.sent;
|
|
180
|
+
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 1);
|
|
181
|
+
pinned = _yield$Promise$all2[0];
|
|
182
|
+
toPin = (0, _toConsumableArray2.default)(new _set.default((0, _concat.default)(_context = []).call(_context, (0, _toConsumableArray2.default)(pinned || []), objectKeys)));
|
|
183
|
+
return _context2.abrupt("return", _this.pinWithName(pinName, toPin));
|
|
184
|
+
case 13:
|
|
185
|
+
case "end":
|
|
186
|
+
return _context2.stop();
|
|
646
187
|
}
|
|
647
188
|
}, _callee);
|
|
648
189
|
}))();
|
|
649
190
|
},
|
|
650
191
|
// Removes object and children keys from pin name
|
|
651
192
|
// Keeps the object and children pinned
|
|
652
|
-
_handleUnPinAllWithName: function
|
|
653
|
-
/*: string*/
|
|
654
|
-
, objects
|
|
655
|
-
/*: Array<ParseObject>*/
|
|
656
|
-
) {
|
|
193
|
+
_handleUnPinAllWithName: function (name /*: string*/, objects /*: Array<ParseObject>*/) {
|
|
657
194
|
var _this2 = this;
|
|
658
|
-
|
|
659
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
195
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
660
196
|
var localDatastore, pinName, promises, objectKeys, _iterator2, _step2, _objectKeys, _context3, parent, children, parentKey, pinned, _iterator3, _step3, objectKey, hasReference, key, pinnedObjects;
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
parent = _step2.value;
|
|
679
|
-
children = _this2._getChildren(parent);
|
|
680
|
-
parentKey = _this2.getKeyForObject(parent);
|
|
681
|
-
|
|
682
|
-
(_objectKeys = objectKeys).push.apply(_objectKeys, (0, _concat.default)(_context3 = [parentKey]).call(_context3, (0, _toConsumableArray2.default)((0, _keys3.default)(children))));
|
|
683
|
-
}
|
|
684
|
-
} catch (err) {
|
|
685
|
-
_iterator2.e(err);
|
|
686
|
-
} finally {
|
|
687
|
-
_iterator2.f();
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
objectKeys = (0, _toConsumableArray2.default)(new _set.default(objectKeys));
|
|
691
|
-
pinned = localDatastore[pinName] || [];
|
|
692
|
-
pinned = (0, _filter.default)(pinned).call(pinned, function (item) {
|
|
693
|
-
return !(0, _includes.default)(objectKeys).call(objectKeys, item);
|
|
694
|
-
});
|
|
695
|
-
|
|
696
|
-
if (pinned.length == 0) {
|
|
697
|
-
promises.push(_this2.unPinWithName(pinName));
|
|
698
|
-
delete localDatastore[pinName];
|
|
699
|
-
} else {
|
|
700
|
-
promises.push(_this2.pinWithName(pinName, pinned));
|
|
701
|
-
localDatastore[pinName] = pinned;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
_iterator3 = _createForOfIteratorHelper(objectKeys);
|
|
705
|
-
_context4.prev = 13;
|
|
706
|
-
|
|
707
|
-
_iterator3.s();
|
|
708
|
-
|
|
709
|
-
case 15:
|
|
710
|
-
if ((_step3 = _iterator3.n()).done) {
|
|
711
|
-
_context4.next = 31;
|
|
712
|
-
break;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
objectKey = _step3.value;
|
|
716
|
-
hasReference = false;
|
|
717
|
-
_context4.t0 = (0, _keys2.default)(_regenerator.default).call(_regenerator.default, localDatastore);
|
|
718
|
-
|
|
719
|
-
case 19:
|
|
720
|
-
if ((_context4.t1 = _context4.t0()).done) {
|
|
721
|
-
_context4.next = 28;
|
|
722
|
-
break;
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
key = _context4.t1.value;
|
|
726
|
-
|
|
727
|
-
if (!(key === _LocalDatastoreUtils.DEFAULT_PIN || (0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.PIN_PREFIX))) {
|
|
728
|
-
_context4.next = 26;
|
|
729
|
-
break;
|
|
197
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
198
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
199
|
+
case 0:
|
|
200
|
+
_context4.next = 2;
|
|
201
|
+
return _this2._getAllContents();
|
|
202
|
+
case 2:
|
|
203
|
+
localDatastore = _context4.sent;
|
|
204
|
+
pinName = _this2.getPinName(name);
|
|
205
|
+
promises = [];
|
|
206
|
+
objectKeys = [];
|
|
207
|
+
_iterator2 = _createForOfIteratorHelper(objects);
|
|
208
|
+
try {
|
|
209
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
210
|
+
parent = _step2.value;
|
|
211
|
+
children = _this2._getChildren(parent);
|
|
212
|
+
parentKey = _this2.getKeyForObject(parent);
|
|
213
|
+
(_objectKeys = objectKeys).push.apply(_objectKeys, (0, _concat.default)(_context3 = [parentKey]).call(_context3, (0, _toConsumableArray2.default)((0, _keys2.default)(children))));
|
|
730
214
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
215
|
+
} catch (err) {
|
|
216
|
+
_iterator2.e(err);
|
|
217
|
+
} finally {
|
|
218
|
+
_iterator2.f();
|
|
219
|
+
}
|
|
220
|
+
objectKeys = (0, _toConsumableArray2.default)(new _set.default(objectKeys));
|
|
221
|
+
pinned = localDatastore[pinName] || [];
|
|
222
|
+
pinned = (0, _filter.default)(pinned).call(pinned, function (item) {
|
|
223
|
+
return !(0, _includes.default)(objectKeys).call(objectKeys, item);
|
|
224
|
+
});
|
|
225
|
+
if (pinned.length == 0) {
|
|
226
|
+
promises.push(_this2.unPinWithName(pinName));
|
|
227
|
+
delete localDatastore[pinName];
|
|
228
|
+
} else {
|
|
229
|
+
promises.push(_this2.pinWithName(pinName, pinned));
|
|
230
|
+
localDatastore[pinName] = pinned;
|
|
231
|
+
}
|
|
232
|
+
_iterator3 = _createForOfIteratorHelper(objectKeys);
|
|
233
|
+
_context4.prev = 13;
|
|
234
|
+
_iterator3.s();
|
|
235
|
+
case 15:
|
|
236
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
237
|
+
_context4.next = 31;
|
|
744
238
|
break;
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
_context4.next = 15;
|
|
239
|
+
}
|
|
240
|
+
objectKey = _step3.value;
|
|
241
|
+
hasReference = false;
|
|
242
|
+
_context4.t0 = (0, _keys3.default)(_regenerator.default).call(_regenerator.default, localDatastore);
|
|
243
|
+
case 19:
|
|
244
|
+
if ((_context4.t1 = _context4.t0()).done) {
|
|
245
|
+
_context4.next = 28;
|
|
753
246
|
break;
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
247
|
+
}
|
|
248
|
+
key = _context4.t1.value;
|
|
249
|
+
if (!(key === _LocalDatastoreUtils.DEFAULT_PIN || (0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.PIN_PREFIX))) {
|
|
250
|
+
_context4.next = 26;
|
|
757
251
|
break;
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
_context4.
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
252
|
+
}
|
|
253
|
+
pinnedObjects = localDatastore[key] || [];
|
|
254
|
+
if (!(0, _includes.default)(pinnedObjects).call(pinnedObjects, objectKey)) {
|
|
255
|
+
_context4.next = 26;
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
hasReference = true;
|
|
259
|
+
return _context4.abrupt("break", 28);
|
|
260
|
+
case 26:
|
|
261
|
+
_context4.next = 19;
|
|
262
|
+
break;
|
|
263
|
+
case 28:
|
|
264
|
+
if (!hasReference) {
|
|
265
|
+
promises.push(_this2.unPinWithName(objectKey));
|
|
266
|
+
}
|
|
267
|
+
case 29:
|
|
268
|
+
_context4.next = 15;
|
|
269
|
+
break;
|
|
270
|
+
case 31:
|
|
271
|
+
_context4.next = 36;
|
|
272
|
+
break;
|
|
273
|
+
case 33:
|
|
274
|
+
_context4.prev = 33;
|
|
275
|
+
_context4.t2 = _context4["catch"](13);
|
|
276
|
+
_iterator3.e(_context4.t2);
|
|
277
|
+
case 36:
|
|
278
|
+
_context4.prev = 36;
|
|
279
|
+
_iterator3.f();
|
|
280
|
+
return _context4.finish(36);
|
|
281
|
+
case 39:
|
|
282
|
+
return _context4.abrupt("return", _promise.default.all(promises));
|
|
283
|
+
case 40:
|
|
284
|
+
case "end":
|
|
285
|
+
return _context4.stop();
|
|
779
286
|
}
|
|
780
287
|
}, _callee2, null, [[13, 33, 36, 39]]);
|
|
781
288
|
}))();
|
|
782
289
|
},
|
|
783
290
|
// Retrieve all pointer fields from object recursively
|
|
784
|
-
_getChildren: function
|
|
785
|
-
/*: ParseObject*/
|
|
786
|
-
) {
|
|
291
|
+
_getChildren: function (object /*: ParseObject*/) {
|
|
787
292
|
var encountered = {};
|
|
788
|
-
|
|
789
293
|
var json = object._toFullJSON(undefined, true);
|
|
790
|
-
|
|
791
294
|
for (var key in json) {
|
|
792
295
|
if (json[key] && json[key].__type && json[key].__type === 'Object') {
|
|
793
296
|
this._traverse(json[key], encountered);
|
|
794
297
|
}
|
|
795
298
|
}
|
|
796
|
-
|
|
797
299
|
return encountered;
|
|
798
300
|
},
|
|
799
|
-
_traverse: function
|
|
800
|
-
/*: any*/
|
|
801
|
-
, encountered
|
|
802
|
-
/*: any*/
|
|
803
|
-
) {
|
|
301
|
+
_traverse: function (object /*: any*/, encountered /*: any*/) {
|
|
804
302
|
if (!object.objectId) {
|
|
805
303
|
return;
|
|
806
304
|
} else {
|
|
807
305
|
var objectKey = this.getKeyForObject(object);
|
|
808
|
-
|
|
809
306
|
if (encountered[objectKey]) {
|
|
810
307
|
return;
|
|
811
308
|
}
|
|
812
|
-
|
|
813
309
|
encountered[objectKey] = object;
|
|
814
310
|
}
|
|
815
|
-
|
|
816
311
|
for (var key in object) {
|
|
817
312
|
var json = object[key];
|
|
818
|
-
|
|
819
313
|
if (!object[key]) {
|
|
820
314
|
json = object;
|
|
821
315
|
}
|
|
822
|
-
|
|
823
316
|
if (json.__type && json.__type === 'Object') {
|
|
824
317
|
this._traverse(json, encountered);
|
|
825
318
|
}
|
|
826
319
|
}
|
|
827
320
|
},
|
|
828
321
|
// Transform keys in pin name to objects
|
|
829
|
-
_serializeObjectsFromPinName: function
|
|
830
|
-
/*: string*/
|
|
831
|
-
) {
|
|
322
|
+
_serializeObjectsFromPinName: function (name /*: string*/) {
|
|
832
323
|
var _this3 = this;
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
var _context5, _concatInstanceProper, _context6;
|
|
836
|
-
|
|
324
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
325
|
+
var _ref;
|
|
837
326
|
var localDatastore, allObjects, key, pinName, pinned, promises, objects;
|
|
838
|
-
return
|
|
839
|
-
while (1) {
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
for (key in localDatastore) {
|
|
850
|
-
if ((0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.OBJECT_PREFIX)) {
|
|
851
|
-
allObjects.push(localDatastore[key][0]);
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
if (name) {
|
|
856
|
-
_context7.next = 7;
|
|
857
|
-
break;
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
return _context7.abrupt("return", allObjects);
|
|
861
|
-
|
|
862
|
-
case 7:
|
|
863
|
-
pinName = _this3.getPinName(name);
|
|
864
|
-
pinned = localDatastore[pinName];
|
|
865
|
-
|
|
866
|
-
if ((0, _isArray.default)(pinned)) {
|
|
867
|
-
_context7.next = 11;
|
|
868
|
-
break;
|
|
327
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
328
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
329
|
+
case 0:
|
|
330
|
+
_context5.next = 2;
|
|
331
|
+
return _this3._getAllContents();
|
|
332
|
+
case 2:
|
|
333
|
+
localDatastore = _context5.sent;
|
|
334
|
+
allObjects = [];
|
|
335
|
+
for (key in localDatastore) {
|
|
336
|
+
if ((0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.OBJECT_PREFIX)) {
|
|
337
|
+
allObjects.push(localDatastore[key][0]);
|
|
869
338
|
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
339
|
+
}
|
|
340
|
+
if (name) {
|
|
341
|
+
_context5.next = 7;
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
return _context5.abrupt("return", allObjects);
|
|
345
|
+
case 7:
|
|
346
|
+
pinName = _this3.getPinName(name);
|
|
347
|
+
pinned = localDatastore[pinName];
|
|
348
|
+
if ((0, _isArray.default)(pinned)) {
|
|
349
|
+
_context5.next = 11;
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
return _context5.abrupt("return", []);
|
|
353
|
+
case 11:
|
|
354
|
+
promises = (0, _map.default)(pinned).call(pinned, function (objectKey) {
|
|
355
|
+
return _this3.fromPinWithName(objectKey);
|
|
356
|
+
});
|
|
357
|
+
_context5.next = 14;
|
|
358
|
+
return _promise.default.all(promises);
|
|
359
|
+
case 14:
|
|
360
|
+
objects = _context5.sent;
|
|
361
|
+
objects = (0, _concat.default)(_ref = []).apply(_ref, (0, _toConsumableArray2.default)(objects));
|
|
362
|
+
return _context5.abrupt("return", (0, _filter.default)(objects).call(objects, function (object) {
|
|
363
|
+
return object != null;
|
|
364
|
+
}));
|
|
365
|
+
case 17:
|
|
366
|
+
case "end":
|
|
367
|
+
return _context5.stop();
|
|
891
368
|
}
|
|
892
369
|
}, _callee3);
|
|
893
370
|
}))();
|
|
@@ -895,123 +372,90 @@ var LocalDatastore = {
|
|
|
895
372
|
// Replaces object pointers with pinned pointers
|
|
896
373
|
// The object pointers may contain old data
|
|
897
374
|
// Uses Breadth First Search Algorithm
|
|
898
|
-
_serializeObject: function
|
|
899
|
-
/*: string*/
|
|
900
|
-
, localDatastore
|
|
901
|
-
/*: any*/
|
|
902
|
-
) {
|
|
375
|
+
_serializeObject: function (objectKey /*: string*/, localDatastore /*: any*/) {
|
|
903
376
|
var _this4 = this;
|
|
904
|
-
|
|
905
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
377
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
906
378
|
var LDS, root, queue, meta, uniqueId, nodeId, subTreeRoot, field, value, key, pointer;
|
|
907
|
-
return
|
|
908
|
-
while (1) {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
value = subTreeRoot[field];
|
|
946
|
-
|
|
947
|
-
if (value.__type && value.__type === 'Object') {
|
|
948
|
-
key = _this4.getKeyForObject(value);
|
|
949
|
-
|
|
950
|
-
if (LDS[key] && LDS[key].length > 0) {
|
|
951
|
-
pointer = LDS[key][0];
|
|
952
|
-
uniqueId++;
|
|
953
|
-
meta[uniqueId] = pointer;
|
|
954
|
-
subTreeRoot[field] = pointer;
|
|
955
|
-
queue.push(uniqueId);
|
|
956
|
-
}
|
|
379
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
380
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
381
|
+
case 0:
|
|
382
|
+
LDS = localDatastore;
|
|
383
|
+
if (LDS) {
|
|
384
|
+
_context6.next = 5;
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
_context6.next = 4;
|
|
388
|
+
return _this4._getAllContents();
|
|
389
|
+
case 4:
|
|
390
|
+
LDS = _context6.sent;
|
|
391
|
+
case 5:
|
|
392
|
+
if (!(!LDS[objectKey] || LDS[objectKey].length === 0)) {
|
|
393
|
+
_context6.next = 7;
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
return _context6.abrupt("return", null);
|
|
397
|
+
case 7:
|
|
398
|
+
root = LDS[objectKey][0];
|
|
399
|
+
queue = [];
|
|
400
|
+
meta = {};
|
|
401
|
+
uniqueId = 0;
|
|
402
|
+
meta[uniqueId] = root;
|
|
403
|
+
queue.push(uniqueId);
|
|
404
|
+
while (queue.length !== 0) {
|
|
405
|
+
nodeId = queue.shift();
|
|
406
|
+
subTreeRoot = meta[nodeId];
|
|
407
|
+
for (field in subTreeRoot) {
|
|
408
|
+
value = subTreeRoot[field];
|
|
409
|
+
if (value.__type && value.__type === 'Object') {
|
|
410
|
+
key = _this4.getKeyForObject(value);
|
|
411
|
+
if (LDS[key] && LDS[key].length > 0) {
|
|
412
|
+
pointer = LDS[key][0];
|
|
413
|
+
uniqueId++;
|
|
414
|
+
meta[uniqueId] = pointer;
|
|
415
|
+
subTreeRoot[field] = pointer;
|
|
416
|
+
queue.push(uniqueId);
|
|
957
417
|
}
|
|
958
418
|
}
|
|
959
419
|
}
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
return _context8.stop();
|
|
966
|
-
}
|
|
420
|
+
}
|
|
421
|
+
return _context6.abrupt("return", root);
|
|
422
|
+
case 15:
|
|
423
|
+
case "end":
|
|
424
|
+
return _context6.stop();
|
|
967
425
|
}
|
|
968
426
|
}, _callee4);
|
|
969
427
|
}))();
|
|
970
428
|
},
|
|
971
429
|
// Called when an object is save / fetched
|
|
972
430
|
// Update object pin value
|
|
973
|
-
_updateObjectIfPinned: function
|
|
974
|
-
/*: ParseObject*/
|
|
975
|
-
)
|
|
976
|
-
/*: Promise<void>*/
|
|
977
|
-
{
|
|
431
|
+
_updateObjectIfPinned: function (object /*: ParseObject*/) /*: Promise<void>*/{
|
|
978
432
|
var _this5 = this;
|
|
979
|
-
|
|
980
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
433
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
981
434
|
var objectKey, pinned;
|
|
982
|
-
return
|
|
983
|
-
while (1) {
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
return _context9.abrupt("return");
|
|
1007
|
-
|
|
1008
|
-
case 8:
|
|
1009
|
-
return _context9.abrupt("return", _this5.pinWithName(objectKey, [object._toFullJSON()]));
|
|
1010
|
-
|
|
1011
|
-
case 9:
|
|
1012
|
-
case "end":
|
|
1013
|
-
return _context9.stop();
|
|
1014
|
-
}
|
|
435
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
436
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
437
|
+
case 0:
|
|
438
|
+
if (_this5.isEnabled) {
|
|
439
|
+
_context7.next = 2;
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
return _context7.abrupt("return");
|
|
443
|
+
case 2:
|
|
444
|
+
objectKey = _this5.getKeyForObject(object);
|
|
445
|
+
_context7.next = 5;
|
|
446
|
+
return _this5.fromPinWithName(objectKey);
|
|
447
|
+
case 5:
|
|
448
|
+
pinned = _context7.sent;
|
|
449
|
+
if (!(!pinned || pinned.length === 0)) {
|
|
450
|
+
_context7.next = 8;
|
|
451
|
+
break;
|
|
452
|
+
}
|
|
453
|
+
return _context7.abrupt("return");
|
|
454
|
+
case 8:
|
|
455
|
+
return _context7.abrupt("return", _this5.pinWithName(objectKey, [object._toFullJSON()]));
|
|
456
|
+
case 9:
|
|
457
|
+
case "end":
|
|
458
|
+
return _context7.stop();
|
|
1015
459
|
}
|
|
1016
460
|
}, _callee5);
|
|
1017
461
|
}))();
|
|
@@ -1019,147 +463,111 @@ var LocalDatastore = {
|
|
|
1019
463
|
// Called when object is destroyed
|
|
1020
464
|
// Unpin object and remove all references from pin names
|
|
1021
465
|
// TODO: Destroy children?
|
|
1022
|
-
_destroyObjectIfPinned: function
|
|
1023
|
-
/*: ParseObject*/
|
|
1024
|
-
) {
|
|
466
|
+
_destroyObjectIfPinned: function (object /*: ParseObject*/) {
|
|
1025
467
|
var _this6 = this;
|
|
1026
|
-
|
|
1027
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
468
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
1028
469
|
var localDatastore, objectKey, pin, promises, key, pinned;
|
|
1029
|
-
return
|
|
1030
|
-
while (1) {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
pinned = (0, _filter.default)(pinned).call(pinned, function (item) {
|
|
1066
|
-
return item !== objectKey;
|
|
1067
|
-
});
|
|
1068
|
-
|
|
1069
|
-
if (pinned.length == 0) {
|
|
1070
|
-
promises.push(_this6.unPinWithName(key));
|
|
1071
|
-
delete localDatastore[key];
|
|
1072
|
-
} else {
|
|
1073
|
-
promises.push(_this6.pinWithName(key, pinned));
|
|
1074
|
-
localDatastore[key] = pinned;
|
|
1075
|
-
}
|
|
470
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
471
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
472
|
+
case 0:
|
|
473
|
+
if (_this6.isEnabled) {
|
|
474
|
+
_context8.next = 2;
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
return _context8.abrupt("return");
|
|
478
|
+
case 2:
|
|
479
|
+
_context8.next = 4;
|
|
480
|
+
return _this6._getAllContents();
|
|
481
|
+
case 4:
|
|
482
|
+
localDatastore = _context8.sent;
|
|
483
|
+
objectKey = _this6.getKeyForObject(object);
|
|
484
|
+
pin = localDatastore[objectKey];
|
|
485
|
+
if (pin) {
|
|
486
|
+
_context8.next = 9;
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
return _context8.abrupt("return");
|
|
490
|
+
case 9:
|
|
491
|
+
promises = [_this6.unPinWithName(objectKey)];
|
|
492
|
+
delete localDatastore[objectKey];
|
|
493
|
+
for (key in localDatastore) {
|
|
494
|
+
if (key === _LocalDatastoreUtils.DEFAULT_PIN || (0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.PIN_PREFIX)) {
|
|
495
|
+
pinned = localDatastore[key] || [];
|
|
496
|
+
if ((0, _includes.default)(pinned).call(pinned, objectKey)) {
|
|
497
|
+
pinned = (0, _filter.default)(pinned).call(pinned, function (item) {
|
|
498
|
+
return item !== objectKey;
|
|
499
|
+
});
|
|
500
|
+
if (pinned.length == 0) {
|
|
501
|
+
promises.push(_this6.unPinWithName(key));
|
|
502
|
+
delete localDatastore[key];
|
|
503
|
+
} else {
|
|
504
|
+
promises.push(_this6.pinWithName(key, pinned));
|
|
505
|
+
localDatastore[key] = pinned;
|
|
1076
506
|
}
|
|
1077
507
|
}
|
|
1078
508
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
return _context10.stop();
|
|
1085
|
-
}
|
|
509
|
+
}
|
|
510
|
+
return _context8.abrupt("return", _promise.default.all(promises));
|
|
511
|
+
case 13:
|
|
512
|
+
case "end":
|
|
513
|
+
return _context8.stop();
|
|
1086
514
|
}
|
|
1087
515
|
}, _callee6);
|
|
1088
516
|
}))();
|
|
1089
517
|
},
|
|
1090
518
|
// Update pin and references of the unsaved object
|
|
1091
|
-
_updateLocalIdForObject: function
|
|
1092
|
-
/*: string*/
|
|
1093
|
-
, object
|
|
1094
|
-
/*: ParseObject*/
|
|
1095
|
-
) {
|
|
519
|
+
_updateLocalIdForObject: function (localId /*: string*/, object /*: ParseObject*/) {
|
|
1096
520
|
var _this7 = this;
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
var _context11, _context12;
|
|
1100
|
-
|
|
521
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
522
|
+
var _context9, _context10;
|
|
1101
523
|
var localKey, objectKey, unsaved, promises, localDatastore, key, pinned;
|
|
1102
|
-
return
|
|
1103
|
-
while (1) {
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
if (key === _LocalDatastoreUtils.DEFAULT_PIN || (0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.PIN_PREFIX)) {
|
|
1139
|
-
pinned = localDatastore[key] || [];
|
|
1140
|
-
|
|
1141
|
-
if ((0, _includes.default)(pinned).call(pinned, localKey)) {
|
|
1142
|
-
pinned = (0, _filter.default)(pinned).call(pinned, function (item) {
|
|
1143
|
-
return item !== localKey;
|
|
1144
|
-
});
|
|
1145
|
-
pinned.push(objectKey);
|
|
1146
|
-
promises.push(_this7.pinWithName(key, pinned));
|
|
1147
|
-
localDatastore[key] = pinned;
|
|
1148
|
-
}
|
|
524
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
525
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
526
|
+
case 0:
|
|
527
|
+
if (_this7.isEnabled) {
|
|
528
|
+
_context11.next = 2;
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
531
|
+
return _context11.abrupt("return");
|
|
532
|
+
case 2:
|
|
533
|
+
localKey = (0, _concat.default)(_context9 = (0, _concat.default)(_context10 = "".concat(_LocalDatastoreUtils.OBJECT_PREFIX)).call(_context10, object.className, "_")).call(_context9, localId);
|
|
534
|
+
objectKey = _this7.getKeyForObject(object);
|
|
535
|
+
_context11.next = 6;
|
|
536
|
+
return _this7.fromPinWithName(localKey);
|
|
537
|
+
case 6:
|
|
538
|
+
unsaved = _context11.sent;
|
|
539
|
+
if (!(!unsaved || unsaved.length === 0)) {
|
|
540
|
+
_context11.next = 9;
|
|
541
|
+
break;
|
|
542
|
+
}
|
|
543
|
+
return _context11.abrupt("return");
|
|
544
|
+
case 9:
|
|
545
|
+
promises = [_this7.unPinWithName(localKey), _this7.pinWithName(objectKey, unsaved)];
|
|
546
|
+
_context11.next = 12;
|
|
547
|
+
return _this7._getAllContents();
|
|
548
|
+
case 12:
|
|
549
|
+
localDatastore = _context11.sent;
|
|
550
|
+
for (key in localDatastore) {
|
|
551
|
+
if (key === _LocalDatastoreUtils.DEFAULT_PIN || (0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.PIN_PREFIX)) {
|
|
552
|
+
pinned = localDatastore[key] || [];
|
|
553
|
+
if ((0, _includes.default)(pinned).call(pinned, localKey)) {
|
|
554
|
+
pinned = (0, _filter.default)(pinned).call(pinned, function (item) {
|
|
555
|
+
return item !== localKey;
|
|
556
|
+
});
|
|
557
|
+
pinned.push(objectKey);
|
|
558
|
+
promises.push(_this7.pinWithName(key, pinned));
|
|
559
|
+
localDatastore[key] = pinned;
|
|
1149
560
|
}
|
|
1150
561
|
}
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
return _context13.stop();
|
|
1157
|
-
}
|
|
562
|
+
}
|
|
563
|
+
return _context11.abrupt("return", _promise.default.all(promises));
|
|
564
|
+
case 15:
|
|
565
|
+
case "end":
|
|
566
|
+
return _context11.stop();
|
|
1158
567
|
}
|
|
1159
568
|
}, _callee7);
|
|
1160
569
|
}))();
|
|
1161
570
|
},
|
|
1162
|
-
|
|
1163
571
|
/**
|
|
1164
572
|
* Updates Local Datastore from Server
|
|
1165
573
|
*
|
|
@@ -1171,161 +579,123 @@ var LocalDatastore = {
|
|
|
1171
579
|
* @name Parse.LocalDatastore.updateFromServer
|
|
1172
580
|
* @static
|
|
1173
581
|
*/
|
|
1174
|
-
updateFromServer: function
|
|
582
|
+
updateFromServer: function () {
|
|
1175
583
|
var _this8 = this;
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
var _context14;
|
|
1179
|
-
|
|
584
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
585
|
+
var _context12;
|
|
1180
586
|
var localDatastore, keys, key, pointersHash, _i, _keys, _key, _key$split, _key$split2, className, objectId, queryPromises, responses, objects, pinPromises;
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
localDatastore = _context15.sent;
|
|
1199
|
-
keys = [];
|
|
1200
|
-
|
|
1201
|
-
for (key in localDatastore) {
|
|
1202
|
-
if ((0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.OBJECT_PREFIX)) {
|
|
1203
|
-
keys.push(key);
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
if (!(keys.length === 0)) {
|
|
1208
|
-
_context15.next = 9;
|
|
1209
|
-
break;
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
return _context15.abrupt("return");
|
|
1213
|
-
|
|
1214
|
-
case 9:
|
|
1215
|
-
_this8.isSyncing = true;
|
|
1216
|
-
pointersHash = {};
|
|
1217
|
-
_i = 0, _keys = keys;
|
|
1218
|
-
|
|
1219
|
-
case 12:
|
|
1220
|
-
if (!(_i < _keys.length)) {
|
|
1221
|
-
_context15.next = 23;
|
|
1222
|
-
break;
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
_key = _keys[_i]; // Ignore the OBJECT_PREFIX
|
|
1226
|
-
|
|
1227
|
-
_key$split = _key.split('_'), _key$split2 = (0, _slicedToArray2.default)(_key$split, 4), className = _key$split2[2], objectId = _key$split2[3]; // User key is split into [ 'Parse', 'LDS', '', 'User', 'objectId' ]
|
|
1228
|
-
|
|
1229
|
-
if (_key.split('_').length === 5 && _key.split('_')[3] === 'User') {
|
|
1230
|
-
className = '_User';
|
|
1231
|
-
objectId = _key.split('_')[4];
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
if (!(0, _startsWith.default)(objectId).call(objectId, 'local')) {
|
|
1235
|
-
_context15.next = 18;
|
|
1236
|
-
break;
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
return _context15.abrupt("continue", 20);
|
|
1240
|
-
|
|
1241
|
-
case 18:
|
|
1242
|
-
if (!(className in pointersHash)) {
|
|
1243
|
-
pointersHash[className] = new _set.default();
|
|
587
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
588
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
589
|
+
case 0:
|
|
590
|
+
if (!(!_this8.checkIfEnabled() || _this8.isSyncing)) {
|
|
591
|
+
_context13.next = 2;
|
|
592
|
+
break;
|
|
593
|
+
}
|
|
594
|
+
return _context13.abrupt("return");
|
|
595
|
+
case 2:
|
|
596
|
+
_context13.next = 4;
|
|
597
|
+
return _this8._getAllContents();
|
|
598
|
+
case 4:
|
|
599
|
+
localDatastore = _context13.sent;
|
|
600
|
+
keys = [];
|
|
601
|
+
for (key in localDatastore) {
|
|
602
|
+
if ((0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.OBJECT_PREFIX)) {
|
|
603
|
+
keys.push(key);
|
|
1244
604
|
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
case 20:
|
|
1249
|
-
_i++;
|
|
1250
|
-
_context15.next = 12;
|
|
605
|
+
}
|
|
606
|
+
if (!(keys.length === 0)) {
|
|
607
|
+
_context13.next = 9;
|
|
1251
608
|
break;
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
} else {
|
|
1262
|
-
query.containedIn('objectId', objectIds);
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
return (0, _find.default)(query).call(query);
|
|
1266
|
-
});
|
|
1267
|
-
_context15.prev = 24;
|
|
1268
|
-
_context15.next = 27;
|
|
1269
|
-
return _promise.default.all(queryPromises);
|
|
1270
|
-
|
|
1271
|
-
case 27:
|
|
1272
|
-
responses = _context15.sent;
|
|
1273
|
-
objects = (0, _concat.default)([]).apply([], responses);
|
|
1274
|
-
pinPromises = (0, _map.default)(objects).call(objects, function (object) {
|
|
1275
|
-
var objectKey = _this8.getKeyForObject(object);
|
|
1276
|
-
|
|
1277
|
-
return _this8.pinWithName(objectKey, object._toFullJSON());
|
|
1278
|
-
});
|
|
1279
|
-
_context15.next = 32;
|
|
1280
|
-
return _promise.default.all(pinPromises);
|
|
1281
|
-
|
|
1282
|
-
case 32:
|
|
1283
|
-
_this8.isSyncing = false;
|
|
1284
|
-
_context15.next = 39;
|
|
609
|
+
}
|
|
610
|
+
return _context13.abrupt("return");
|
|
611
|
+
case 9:
|
|
612
|
+
_this8.isSyncing = true;
|
|
613
|
+
pointersHash = {};
|
|
614
|
+
_i = 0, _keys = keys;
|
|
615
|
+
case 12:
|
|
616
|
+
if (!(_i < _keys.length)) {
|
|
617
|
+
_context13.next = 23;
|
|
1285
618
|
break;
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
619
|
+
}
|
|
620
|
+
_key = _keys[_i];
|
|
621
|
+
// Ignore the OBJECT_PREFIX
|
|
622
|
+
_key$split = _key.split('_'), _key$split2 = (0, _slicedToArray2.default)(_key$split, 4), className = _key$split2[2], objectId = _key$split2[3]; // User key is split into [ 'Parse', 'LDS', '', 'User', 'objectId' ]
|
|
623
|
+
if (_key.split('_').length === 5 && _key.split('_')[3] === 'User') {
|
|
624
|
+
className = '_User';
|
|
625
|
+
objectId = _key.split('_')[4];
|
|
626
|
+
}
|
|
627
|
+
if (!(0, _startsWith.default)(objectId).call(objectId, 'local')) {
|
|
628
|
+
_context13.next = 18;
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
return _context13.abrupt("continue", 20);
|
|
632
|
+
case 18:
|
|
633
|
+
if (!(className in pointersHash)) {
|
|
634
|
+
pointersHash[className] = new _set.default();
|
|
635
|
+
}
|
|
636
|
+
pointersHash[className].add(objectId);
|
|
637
|
+
case 20:
|
|
638
|
+
_i++;
|
|
639
|
+
_context13.next = 12;
|
|
640
|
+
break;
|
|
641
|
+
case 23:
|
|
642
|
+
queryPromises = (0, _map.default)(_context12 = (0, _keys2.default)(pointersHash)).call(_context12, function (className) {
|
|
643
|
+
var objectIds = (0, _from.default)(pointersHash[className]);
|
|
644
|
+
var query = new _ParseQuery.default(className);
|
|
645
|
+
query.limit(objectIds.length);
|
|
646
|
+
if (objectIds.length === 1) {
|
|
647
|
+
query.equalTo('objectId', objectIds[0]);
|
|
648
|
+
} else {
|
|
649
|
+
query.containedIn('objectId', objectIds);
|
|
650
|
+
}
|
|
651
|
+
return (0, _find.default)(query).call(query);
|
|
652
|
+
});
|
|
653
|
+
_context13.prev = 24;
|
|
654
|
+
_context13.next = 27;
|
|
655
|
+
return _promise.default.all(queryPromises);
|
|
656
|
+
case 27:
|
|
657
|
+
responses = _context13.sent;
|
|
658
|
+
objects = (0, _concat.default)([]).apply([], responses);
|
|
659
|
+
pinPromises = (0, _map.default)(objects).call(objects, function (object) {
|
|
660
|
+
var objectKey = _this8.getKeyForObject(object);
|
|
661
|
+
return _this8.pinWithName(objectKey, object._toFullJSON());
|
|
662
|
+
});
|
|
663
|
+
_context13.next = 32;
|
|
664
|
+
return _promise.default.all(pinPromises);
|
|
665
|
+
case 32:
|
|
666
|
+
_this8.isSyncing = false;
|
|
667
|
+
_context13.next = 39;
|
|
668
|
+
break;
|
|
669
|
+
case 35:
|
|
670
|
+
_context13.prev = 35;
|
|
671
|
+
_context13.t0 = _context13["catch"](24);
|
|
672
|
+
console.error('Error syncing LocalDatastore: ', _context13.t0);
|
|
673
|
+
_this8.isSyncing = false;
|
|
674
|
+
case 39:
|
|
675
|
+
case "end":
|
|
676
|
+
return _context13.stop();
|
|
1297
677
|
}
|
|
1298
678
|
}, _callee8, null, [[24, 35]]);
|
|
1299
679
|
}))();
|
|
1300
680
|
},
|
|
1301
|
-
getKeyForObject: function
|
|
1302
|
-
|
|
1303
|
-
) {
|
|
1304
|
-
var _context16, _context17;
|
|
1305
|
-
|
|
681
|
+
getKeyForObject: function (object /*: any*/) {
|
|
682
|
+
var _context14, _context15;
|
|
1306
683
|
var objectId = object.objectId || object._getId();
|
|
1307
|
-
|
|
1308
|
-
return (0, _concat.default)(_context16 = (0, _concat.default)(_context17 = "".concat(_LocalDatastoreUtils.OBJECT_PREFIX)).call(_context17, object.className, "_")).call(_context16, objectId);
|
|
684
|
+
return (0, _concat.default)(_context14 = (0, _concat.default)(_context15 = "".concat(_LocalDatastoreUtils.OBJECT_PREFIX)).call(_context15, object.className, "_")).call(_context14, objectId);
|
|
1309
685
|
},
|
|
1310
|
-
getPinName: function
|
|
1311
|
-
/*: ?string*/
|
|
1312
|
-
) {
|
|
686
|
+
getPinName: function (pinName /*: ?string*/) {
|
|
1313
687
|
if (!pinName || pinName === _LocalDatastoreUtils.DEFAULT_PIN) {
|
|
1314
688
|
return _LocalDatastoreUtils.DEFAULT_PIN;
|
|
1315
689
|
}
|
|
1316
|
-
|
|
1317
690
|
return _LocalDatastoreUtils.PIN_PREFIX + pinName;
|
|
1318
691
|
},
|
|
1319
|
-
checkIfEnabled: function
|
|
692
|
+
checkIfEnabled: function () {
|
|
1320
693
|
if (!this.isEnabled) {
|
|
1321
694
|
console.error('Parse.enableLocalDatastore() must be called first');
|
|
1322
695
|
}
|
|
1323
|
-
|
|
1324
696
|
return this.isEnabled;
|
|
1325
697
|
}
|
|
1326
698
|
};
|
|
1327
699
|
module.exports = LocalDatastore;
|
|
1328
|
-
|
|
1329
700
|
_CoreManager.default.setLocalDatastoreController(require('./LocalDatastoreController'));
|
|
1330
|
-
|
|
1331
701
|
_CoreManager.default.setLocalDatastore(LocalDatastore);
|