parse 4.0.0-alpha.7 → 4.0.0-alpha.9
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 +1 -3
- package/dist/parse.js +3942 -6528
- package/dist/parse.min.js +7 -6
- package/dist/parse.weapp.js +3103 -6459
- package/dist/parse.weapp.min.js +7 -6
- package/lib/browser/Analytics.js +4 -11
- package/lib/browser/AnonymousUtils.js +2 -9
- package/lib/browser/Cloud.js +4 -11
- package/lib/browser/CloudCode.js +0 -1
- package/lib/browser/CoreManager.js +3 -10
- package/lib/browser/EventEmitter.js +0 -7
- package/lib/browser/EventuallyQueue.js +282 -668
- package/lib/browser/FacebookUtils.js +2 -9
- package/lib/browser/InstallationController.js +0 -7
- package/lib/browser/LiveQueryClient.js +35 -26
- package/lib/browser/LiveQuerySubscription.js +5 -4
- package/lib/browser/LocalDatastore.js +472 -864
- package/lib/browser/LocalDatastoreController.js +161 -547
- package/lib/browser/LocalDatastoreController.react-native.js +156 -537
- package/lib/browser/LocalDatastoreUtils.js +2 -9
- package/lib/browser/ObjectStateMutations.js +25 -25
- package/lib/browser/OfflineQuery.js +31 -33
- package/lib/browser/Parse.js +4 -13
- package/lib/browser/ParseACL.js +9 -16
- package/lib/browser/ParseCLP.js +46 -48
- package/lib/browser/ParseConfig.js +6 -13
- package/lib/browser/ParseError.js +2 -11
- package/lib/browser/ParseFile.js +107 -482
- package/lib/browser/ParseGeoPoint.js +4 -11
- package/lib/browser/ParseHooks.js +2 -2
- package/lib/browser/ParseInstallation.js +2 -2
- package/lib/browser/ParseLiveQuery.js +104 -480
- package/lib/browser/ParseObject.js +549 -935
- package/lib/browser/ParseOp.js +11 -11
- package/lib/browser/ParsePolygon.js +5 -12
- package/lib/browser/ParseQuery.js +365 -758
- package/lib/browser/ParseRelation.js +2 -9
- package/lib/browser/ParseRole.js +2 -2
- package/lib/browser/ParseSchema.js +2 -9
- package/lib/browser/ParseSession.js +2 -2
- package/lib/browser/ParseUser.js +221 -607
- package/lib/browser/Push.js +2 -9
- package/lib/browser/RESTController.js +12 -19
- package/lib/browser/SingleInstanceStateController.js +4 -11
- package/lib/browser/Storage.js +0 -7
- package/lib/browser/StorageController.browser.js +0 -7
- package/lib/browser/StorageController.default.js +0 -7
- package/lib/browser/StorageController.react-native.js +0 -7
- package/lib/browser/StorageController.weapp.js +0 -7
- package/lib/browser/TaskQueue.js +0 -7
- package/lib/browser/UniqueInstanceStateController.js +8 -15
- package/lib/browser/arrayContainsObject.js +2 -9
- package/lib/browser/canBeSerialized.js +2 -9
- package/lib/browser/decode.js +4 -11
- package/lib/browser/encode.js +8 -15
- package/lib/browser/equals.js +4 -13
- package/lib/browser/escape.js +0 -7
- package/lib/browser/isRevocableSession.js +2 -9
- package/lib/browser/parseDate.js +2 -9
- package/lib/browser/promiseUtils.js +4 -4
- package/lib/browser/unique.js +4 -11
- package/lib/browser/unsavedChildren.js +6 -13
- package/lib/browser/uuid.js +5 -1
- package/lib/node/Analytics.js +0 -7
- package/lib/node/AnonymousUtils.js +0 -7
- package/lib/node/Cloud.js +0 -7
- package/lib/node/CloudCode.js +0 -1
- package/lib/node/CoreManager.js +1 -8
- package/lib/node/EventEmitter.js +0 -7
- package/lib/node/FacebookUtils.js +0 -7
- package/lib/node/InstallationController.js +0 -7
- package/lib/node/LiveQueryClient.js +18 -17
- package/lib/node/LiveQuerySubscription.js +2 -11
- package/lib/node/LocalDatastore.js +0 -7
- package/lib/node/LocalDatastoreController.js +0 -7
- package/lib/node/LocalDatastoreController.react-native.js +0 -7
- package/lib/node/LocalDatastoreUtils.js +0 -7
- package/lib/node/ObjectStateMutations.js +0 -7
- package/lib/node/Parse.js +0 -9
- package/lib/node/ParseACL.js +0 -7
- package/lib/node/ParseCLP.js +0 -7
- package/lib/node/ParseConfig.js +0 -7
- package/lib/node/ParseError.js +0 -9
- package/lib/node/ParseFile.js +7 -12
- package/lib/node/ParseGeoPoint.js +0 -7
- package/lib/node/ParseInstallation.js +0 -7
- package/lib/node/ParseLiveQuery.js +0 -7
- package/lib/node/ParseObject.js +10 -14
- package/lib/node/ParseOp.js +0 -7
- package/lib/node/ParsePolygon.js +0 -7
- package/lib/node/ParseQuery.js +3 -18
- package/lib/node/ParseRelation.js +0 -7
- package/lib/node/ParseRole.js +0 -7
- package/lib/node/ParseSchema.js +0 -7
- package/lib/node/ParseSession.js +0 -7
- package/lib/node/ParseUser.js +0 -7
- package/lib/node/Push.js +0 -7
- package/lib/node/RESTController.js +0 -7
- package/lib/node/SingleInstanceStateController.js +0 -7
- package/lib/node/Storage.js +0 -7
- package/lib/node/StorageController.browser.js +0 -7
- package/lib/node/StorageController.default.js +0 -7
- package/lib/node/StorageController.react-native.js +0 -7
- package/lib/node/StorageController.weapp.js +0 -7
- package/lib/node/TaskQueue.js +0 -7
- package/lib/node/UniqueInstanceStateController.js +0 -7
- package/lib/node/arrayContainsObject.js +0 -7
- package/lib/node/canBeSerialized.js +0 -7
- package/lib/node/decode.js +0 -7
- package/lib/node/encode.js +0 -7
- package/lib/node/equals.js +0 -9
- package/lib/node/escape.js +0 -7
- package/lib/node/isRevocableSession.js +0 -7
- package/lib/node/parseDate.js +0 -7
- package/lib/node/unique.js +0 -7
- package/lib/node/unsavedChildren.js +0 -7
- package/lib/node/uuid.js +7 -1
- package/lib/react-native/CoreManager.js +2 -2
- package/lib/react-native/EventuallyQueue.js +169 -676
- package/lib/react-native/LiveQueryClient.js +16 -50
- package/lib/react-native/LiveQuerySubscription.js +3 -2
- package/lib/react-native/LocalDatastore.js +303 -863
- package/lib/react-native/LocalDatastoreController.js +75 -535
- package/lib/react-native/LocalDatastoreController.react-native.js +95 -503
- package/lib/react-native/ObjectStateMutations.js +2 -31
- package/lib/react-native/OfflineQuery.js +17 -63
- package/lib/react-native/ParseCLP.js +55 -129
- package/lib/react-native/ParseFile.js +63 -468
- package/lib/react-native/ParseLiveQuery.js +60 -455
- package/lib/react-native/ParseObject.js +225 -878
- package/lib/react-native/ParseQuery.js +207 -643
- package/lib/react-native/ParseSchema.js +3 -3
- package/lib/react-native/ParseUser.js +118 -573
- package/lib/react-native/RESTController.js +1 -29
- package/lib/react-native/uuid.js +5 -1
- package/lib/weapp/Analytics.js +4 -11
- package/lib/weapp/AnonymousUtils.js +2 -9
- package/lib/weapp/Cloud.js +4 -11
- package/lib/weapp/CloudCode.js +0 -1
- package/lib/weapp/CoreManager.js +3 -10
- package/lib/weapp/EventEmitter.js +0 -7
- package/lib/weapp/EventuallyQueue.js +282 -668
- package/lib/weapp/FacebookUtils.js +2 -9
- package/lib/weapp/InstallationController.js +0 -7
- package/lib/weapp/LiveQueryClient.js +35 -26
- package/lib/weapp/LiveQuerySubscription.js +5 -4
- package/lib/weapp/LocalDatastore.js +472 -864
- package/lib/weapp/LocalDatastoreController.js +161 -547
- package/lib/weapp/LocalDatastoreController.react-native.js +156 -537
- package/lib/weapp/LocalDatastoreUtils.js +2 -9
- package/lib/weapp/ObjectStateMutations.js +25 -25
- package/lib/weapp/OfflineQuery.js +31 -33
- package/lib/weapp/Parse.js +4 -13
- package/lib/weapp/ParseACL.js +9 -16
- package/lib/weapp/ParseCLP.js +46 -48
- package/lib/weapp/ParseConfig.js +6 -13
- package/lib/weapp/ParseError.js +2 -11
- package/lib/weapp/ParseFile.js +107 -482
- package/lib/weapp/ParseGeoPoint.js +4 -11
- package/lib/weapp/ParseHooks.js +2 -2
- package/lib/weapp/ParseInstallation.js +2 -2
- package/lib/weapp/ParseLiveQuery.js +104 -480
- package/lib/weapp/ParseObject.js +549 -935
- package/lib/weapp/ParseOp.js +11 -11
- package/lib/weapp/ParsePolygon.js +5 -12
- package/lib/weapp/ParseQuery.js +365 -758
- package/lib/weapp/ParseRelation.js +2 -9
- package/lib/weapp/ParseRole.js +2 -2
- package/lib/weapp/ParseSchema.js +2 -9
- package/lib/weapp/ParseSession.js +2 -2
- package/lib/weapp/ParseUser.js +221 -607
- package/lib/weapp/Push.js +2 -9
- package/lib/weapp/RESTController.js +12 -19
- package/lib/weapp/SingleInstanceStateController.js +4 -11
- package/lib/weapp/Storage.js +0 -7
- package/lib/weapp/StorageController.browser.js +0 -7
- package/lib/weapp/StorageController.default.js +0 -7
- package/lib/weapp/StorageController.react-native.js +0 -7
- package/lib/weapp/StorageController.weapp.js +0 -7
- package/lib/weapp/TaskQueue.js +0 -7
- package/lib/weapp/UniqueInstanceStateController.js +8 -15
- package/lib/weapp/arrayContainsObject.js +2 -9
- package/lib/weapp/canBeSerialized.js +2 -9
- package/lib/weapp/decode.js +4 -11
- package/lib/weapp/encode.js +8 -15
- package/lib/weapp/equals.js +4 -13
- package/lib/weapp/escape.js +0 -7
- package/lib/weapp/isRevocableSession.js +2 -9
- package/lib/weapp/parseDate.js +2 -9
- package/lib/weapp/promiseUtils.js +4 -4
- package/lib/weapp/unique.js +4 -11
- package/lib/weapp/unsavedChildren.js +6 -13
- package/lib/weapp/uuid.js +2 -0
- package/package.json +24 -24
- package/PATENTS +0 -37
|
@@ -1,61 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
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");
|
|
3
|
+
var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
|
18
4
|
|
|
19
|
-
var
|
|
5
|
+
var _Array$from2 = require("@babel/runtime-corejs3/core-js-stable/array/from");
|
|
20
6
|
|
|
21
|
-
var
|
|
7
|
+
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
|
22
8
|
|
|
23
9
|
var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
|
|
24
10
|
|
|
25
|
-
var
|
|
11
|
+
var _Array$isArray2 = require("@babel/runtime-corejs3/core-js-stable/array/is-array");
|
|
26
12
|
|
|
27
|
-
var
|
|
13
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
28
14
|
|
|
29
|
-
var
|
|
15
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
|
30
16
|
|
|
31
|
-
var
|
|
17
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
32
18
|
|
|
33
|
-
var
|
|
19
|
+
var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
|
|
34
20
|
|
|
35
|
-
var
|
|
21
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
36
22
|
|
|
37
|
-
var
|
|
23
|
+
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
38
24
|
|
|
39
|
-
var
|
|
25
|
+
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
40
26
|
|
|
41
|
-
var _keys2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/
|
|
27
|
+
var _keys2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
42
28
|
|
|
43
29
|
var _startsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/starts-with"));
|
|
44
30
|
|
|
45
|
-
var _keys3 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/
|
|
31
|
+
var _keys3 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/keys"));
|
|
46
32
|
|
|
47
|
-
var
|
|
33
|
+
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
48
34
|
|
|
49
|
-
var
|
|
35
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
50
36
|
|
|
51
|
-
var
|
|
37
|
+
var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
|
|
52
38
|
|
|
53
|
-
var
|
|
39
|
+
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
54
40
|
|
|
55
41
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/toConsumableArray"));
|
|
56
42
|
|
|
57
|
-
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
58
|
-
|
|
59
43
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
|
60
44
|
|
|
61
45
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
@@ -66,364 +50,6 @@ var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
|
66
50
|
|
|
67
51
|
var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
|
|
68
52
|
|
|
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
53
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
428
54
|
var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
|
|
429
55
|
|
|
@@ -482,12 +108,12 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
482
108
|
}
|
|
483
109
|
|
|
484
110
|
function _unsupportedIterableToArray(o, minLen) {
|
|
485
|
-
var
|
|
111
|
+
var _context16;
|
|
486
112
|
|
|
487
113
|
if (!o) return;
|
|
488
114
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
489
115
|
|
|
490
|
-
var n = _sliceInstanceProperty(
|
|
116
|
+
var n = _sliceInstanceProperty(_context16 = Object.prototype.toString.call(o)).call(_context16, 8, -1);
|
|
491
117
|
|
|
492
118
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
493
119
|
if (n === "Map" || n === "Set") return _Array$from2(o);
|
|
@@ -497,9 +123,7 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
497
123
|
function _arrayLikeToArray(arr, len) {
|
|
498
124
|
if (len == null || len > arr.length) len = arr.length;
|
|
499
125
|
|
|
500
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
501
|
-
arr2[i] = arr[i];
|
|
502
|
-
}
|
|
126
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
503
127
|
|
|
504
128
|
return arr2;
|
|
505
129
|
}
|
|
@@ -590,198 +214,194 @@ var LocalDatastore = {
|
|
|
590
214
|
{
|
|
591
215
|
var _this = this;
|
|
592
216
|
|
|
593
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
217
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
594
218
|
var _context;
|
|
595
219
|
|
|
596
220
|
var pinName, toPinPromises, objectKeys, _iterator, _step, parent, children, parentKey, json, objectKey, fromPinPromise, _yield$Promise$all, _yield$Promise$all2, pinned, toPin;
|
|
597
221
|
|
|
598
|
-
return
|
|
599
|
-
while (1) {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
}
|
|
222
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
223
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
224
|
+
case 0:
|
|
225
|
+
pinName = _this.getPinName(name);
|
|
226
|
+
toPinPromises = [];
|
|
227
|
+
objectKeys = [];
|
|
228
|
+
_iterator = _createForOfIteratorHelper(objects);
|
|
229
|
+
|
|
230
|
+
try {
|
|
231
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
232
|
+
parent = _step.value;
|
|
233
|
+
children = _this._getChildren(parent);
|
|
234
|
+
parentKey = _this.getKeyForObject(parent);
|
|
235
|
+
json = parent._toFullJSON(undefined, true);
|
|
236
|
+
|
|
237
|
+
if (parent._localId) {
|
|
238
|
+
json._localId = parent._localId;
|
|
239
|
+
}
|
|
617
240
|
|
|
618
|
-
|
|
241
|
+
children[parentKey] = json;
|
|
619
242
|
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
}
|
|
243
|
+
for (objectKey in children) {
|
|
244
|
+
objectKeys.push(objectKey);
|
|
245
|
+
toPinPromises.push(_this.pinWithName(objectKey, [children[objectKey]]));
|
|
624
246
|
}
|
|
625
|
-
} catch (err) {
|
|
626
|
-
_iterator.e(err);
|
|
627
|
-
} finally {
|
|
628
|
-
_iterator.f();
|
|
629
247
|
}
|
|
248
|
+
} catch (err) {
|
|
249
|
+
_iterator.e(err);
|
|
250
|
+
} finally {
|
|
251
|
+
_iterator.f();
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
fromPinPromise = _this.fromPinWithName(pinName);
|
|
255
|
+
_context2.next = 8;
|
|
256
|
+
return _promise.default.all([fromPinPromise, toPinPromises]);
|
|
630
257
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
case 13:
|
|
643
|
-
case "end":
|
|
644
|
-
return _context2.stop();
|
|
645
|
-
}
|
|
258
|
+
case 8:
|
|
259
|
+
_yield$Promise$all = _context2.sent;
|
|
260
|
+
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 1);
|
|
261
|
+
pinned = _yield$Promise$all2[0];
|
|
262
|
+
toPin = (0, _toConsumableArray2.default)(new _set.default((0, _concat.default)(_context = []).call(_context, (0, _toConsumableArray2.default)(pinned || []), objectKeys)));
|
|
263
|
+
return _context2.abrupt("return", _this.pinWithName(pinName, toPin));
|
|
264
|
+
|
|
265
|
+
case 13:
|
|
266
|
+
case "end":
|
|
267
|
+
return _context2.stop();
|
|
646
268
|
}
|
|
647
269
|
}, _callee);
|
|
648
270
|
}))();
|
|
649
271
|
},
|
|
650
272
|
// Removes object and children keys from pin name
|
|
651
273
|
// Keeps the object and children pinned
|
|
652
|
-
_handleUnPinAllWithName: function
|
|
274
|
+
_handleUnPinAllWithName: function (name
|
|
653
275
|
/*: string*/
|
|
654
276
|
, objects
|
|
655
277
|
/*: Array<ParseObject>*/
|
|
656
278
|
) {
|
|
657
279
|
var _this2 = this;
|
|
658
280
|
|
|
659
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
281
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
660
282
|
var localDatastore, pinName, promises, objectKeys, _iterator2, _step2, _objectKeys, _context3, parent, children, parentKey, pinned, _iterator3, _step3, objectKey, hasReference, key, pinnedObjects;
|
|
661
283
|
|
|
662
|
-
return
|
|
663
|
-
while (1) {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
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();
|
|
284
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
285
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
286
|
+
case 0:
|
|
287
|
+
_context4.next = 2;
|
|
288
|
+
return _this2._getAllContents();
|
|
289
|
+
|
|
290
|
+
case 2:
|
|
291
|
+
localDatastore = _context4.sent;
|
|
292
|
+
pinName = _this2.getPinName(name);
|
|
293
|
+
promises = [];
|
|
294
|
+
objectKeys = [];
|
|
295
|
+
_iterator2 = _createForOfIteratorHelper(objects);
|
|
296
|
+
|
|
297
|
+
try {
|
|
298
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
299
|
+
parent = _step2.value;
|
|
300
|
+
children = _this2._getChildren(parent);
|
|
301
|
+
parentKey = _this2.getKeyForObject(parent);
|
|
302
|
+
|
|
303
|
+
(_objectKeys = objectKeys).push.apply(_objectKeys, (0, _concat.default)(_context3 = [parentKey]).call(_context3, (0, _toConsumableArray2.default)((0, _keys2.default)(children))));
|
|
688
304
|
}
|
|
305
|
+
} catch (err) {
|
|
306
|
+
_iterator2.e(err);
|
|
307
|
+
} finally {
|
|
308
|
+
_iterator2.f();
|
|
309
|
+
}
|
|
689
310
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
311
|
+
objectKeys = (0, _toConsumableArray2.default)(new _set.default(objectKeys));
|
|
312
|
+
pinned = localDatastore[pinName] || [];
|
|
313
|
+
pinned = (0, _filter.default)(pinned).call(pinned, function (item) {
|
|
314
|
+
return !(0, _includes.default)(objectKeys).call(objectKeys, item);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
if (pinned.length == 0) {
|
|
318
|
+
promises.push(_this2.unPinWithName(pinName));
|
|
319
|
+
delete localDatastore[pinName];
|
|
320
|
+
} else {
|
|
321
|
+
promises.push(_this2.pinWithName(pinName, pinned));
|
|
322
|
+
localDatastore[pinName] = pinned;
|
|
323
|
+
}
|
|
703
324
|
|
|
704
|
-
|
|
705
|
-
|
|
325
|
+
_iterator3 = _createForOfIteratorHelper(objectKeys);
|
|
326
|
+
_context4.prev = 13;
|
|
706
327
|
|
|
707
|
-
|
|
328
|
+
_iterator3.s();
|
|
708
329
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
330
|
+
case 15:
|
|
331
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
332
|
+
_context4.next = 31;
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
714
335
|
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
336
|
+
objectKey = _step3.value;
|
|
337
|
+
hasReference = false;
|
|
338
|
+
_context4.t0 = (0, _keys3.default)(_regenerator.default).call(_regenerator.default, localDatastore);
|
|
718
339
|
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
340
|
+
case 19:
|
|
341
|
+
if ((_context4.t1 = _context4.t0()).done) {
|
|
342
|
+
_context4.next = 28;
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
724
345
|
|
|
725
|
-
|
|
346
|
+
key = _context4.t1.value;
|
|
726
347
|
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
348
|
+
if (!(key === _LocalDatastoreUtils.DEFAULT_PIN || (0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.PIN_PREFIX))) {
|
|
349
|
+
_context4.next = 26;
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
731
352
|
|
|
732
|
-
|
|
353
|
+
pinnedObjects = localDatastore[key] || [];
|
|
733
354
|
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
355
|
+
if (!(0, _includes.default)(pinnedObjects).call(pinnedObjects, objectKey)) {
|
|
356
|
+
_context4.next = 26;
|
|
357
|
+
break;
|
|
358
|
+
}
|
|
738
359
|
|
|
739
|
-
|
|
740
|
-
|
|
360
|
+
hasReference = true;
|
|
361
|
+
return _context4.abrupt("break", 28);
|
|
741
362
|
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
363
|
+
case 26:
|
|
364
|
+
_context4.next = 19;
|
|
365
|
+
break;
|
|
745
366
|
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
367
|
+
case 28:
|
|
368
|
+
if (!hasReference) {
|
|
369
|
+
promises.push(_this2.unPinWithName(objectKey));
|
|
370
|
+
}
|
|
750
371
|
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
372
|
+
case 29:
|
|
373
|
+
_context4.next = 15;
|
|
374
|
+
break;
|
|
754
375
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
376
|
+
case 31:
|
|
377
|
+
_context4.next = 36;
|
|
378
|
+
break;
|
|
758
379
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
380
|
+
case 33:
|
|
381
|
+
_context4.prev = 33;
|
|
382
|
+
_context4.t2 = _context4["catch"](13);
|
|
762
383
|
|
|
763
|
-
|
|
384
|
+
_iterator3.e(_context4.t2);
|
|
764
385
|
|
|
765
|
-
|
|
766
|
-
|
|
386
|
+
case 36:
|
|
387
|
+
_context4.prev = 36;
|
|
767
388
|
|
|
768
|
-
|
|
389
|
+
_iterator3.f();
|
|
769
390
|
|
|
770
|
-
|
|
391
|
+
return _context4.finish(36);
|
|
771
392
|
|
|
772
|
-
|
|
773
|
-
|
|
393
|
+
case 39:
|
|
394
|
+
return _context4.abrupt("return", _promise.default.all(promises));
|
|
774
395
|
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
}
|
|
396
|
+
case 40:
|
|
397
|
+
case "end":
|
|
398
|
+
return _context4.stop();
|
|
779
399
|
}
|
|
780
400
|
}, _callee2, null, [[13, 33, 36, 39]]);
|
|
781
401
|
}))();
|
|
782
402
|
},
|
|
783
403
|
// Retrieve all pointer fields from object recursively
|
|
784
|
-
_getChildren: function
|
|
404
|
+
_getChildren: function (object
|
|
785
405
|
/*: ParseObject*/
|
|
786
406
|
) {
|
|
787
407
|
var encountered = {};
|
|
@@ -796,7 +416,7 @@ var LocalDatastore = {
|
|
|
796
416
|
|
|
797
417
|
return encountered;
|
|
798
418
|
},
|
|
799
|
-
_traverse: function
|
|
419
|
+
_traverse: function (object
|
|
800
420
|
/*: any*/
|
|
801
421
|
, encountered
|
|
802
422
|
/*: any*/
|
|
@@ -826,68 +446,66 @@ var LocalDatastore = {
|
|
|
826
446
|
}
|
|
827
447
|
},
|
|
828
448
|
// Transform keys in pin name to objects
|
|
829
|
-
_serializeObjectsFromPinName: function
|
|
449
|
+
_serializeObjectsFromPinName: function (name
|
|
830
450
|
/*: string*/
|
|
831
451
|
) {
|
|
832
452
|
var _this3 = this;
|
|
833
453
|
|
|
834
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
835
|
-
var
|
|
454
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
455
|
+
var _ref;
|
|
836
456
|
|
|
837
457
|
var localDatastore, allObjects, key, pinName, pinned, promises, objects;
|
|
838
|
-
return
|
|
839
|
-
while (1) {
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
allObjects.push(localDatastore[key][0]);
|
|
852
|
-
}
|
|
458
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
459
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
460
|
+
case 0:
|
|
461
|
+
_context5.next = 2;
|
|
462
|
+
return _this3._getAllContents();
|
|
463
|
+
|
|
464
|
+
case 2:
|
|
465
|
+
localDatastore = _context5.sent;
|
|
466
|
+
allObjects = [];
|
|
467
|
+
|
|
468
|
+
for (key in localDatastore) {
|
|
469
|
+
if ((0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.OBJECT_PREFIX)) {
|
|
470
|
+
allObjects.push(localDatastore[key][0]);
|
|
853
471
|
}
|
|
472
|
+
}
|
|
854
473
|
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
474
|
+
if (name) {
|
|
475
|
+
_context5.next = 7;
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
859
478
|
|
|
860
|
-
|
|
479
|
+
return _context5.abrupt("return", allObjects);
|
|
861
480
|
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
481
|
+
case 7:
|
|
482
|
+
pinName = _this3.getPinName(name);
|
|
483
|
+
pinned = localDatastore[pinName];
|
|
865
484
|
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
485
|
+
if ((0, _isArray.default)(pinned)) {
|
|
486
|
+
_context5.next = 11;
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
870
489
|
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
}
|
|
490
|
+
return _context5.abrupt("return", []);
|
|
491
|
+
|
|
492
|
+
case 11:
|
|
493
|
+
promises = (0, _map.default)(pinned).call(pinned, function (objectKey) {
|
|
494
|
+
return _this3.fromPinWithName(objectKey);
|
|
495
|
+
});
|
|
496
|
+
_context5.next = 14;
|
|
497
|
+
return _promise.default.all(promises);
|
|
498
|
+
|
|
499
|
+
case 14:
|
|
500
|
+
objects = _context5.sent;
|
|
501
|
+
objects = (0, _concat.default)(_ref = []).apply(_ref, (0, _toConsumableArray2.default)(objects));
|
|
502
|
+
return _context5.abrupt("return", (0, _filter.default)(objects).call(objects, function (object) {
|
|
503
|
+
return object != null;
|
|
504
|
+
}));
|
|
505
|
+
|
|
506
|
+
case 17:
|
|
507
|
+
case "end":
|
|
508
|
+
return _context5.stop();
|
|
891
509
|
}
|
|
892
510
|
}, _callee3);
|
|
893
511
|
}))();
|
|
@@ -895,123 +513,119 @@ var LocalDatastore = {
|
|
|
895
513
|
// Replaces object pointers with pinned pointers
|
|
896
514
|
// The object pointers may contain old data
|
|
897
515
|
// Uses Breadth First Search Algorithm
|
|
898
|
-
_serializeObject: function
|
|
516
|
+
_serializeObject: function (objectKey
|
|
899
517
|
/*: string*/
|
|
900
518
|
, localDatastore
|
|
901
519
|
/*: any*/
|
|
902
520
|
) {
|
|
903
521
|
var _this4 = this;
|
|
904
522
|
|
|
905
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
523
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
906
524
|
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
|
-
}
|
|
525
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
526
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
527
|
+
case 0:
|
|
528
|
+
LDS = localDatastore;
|
|
529
|
+
|
|
530
|
+
if (LDS) {
|
|
531
|
+
_context6.next = 5;
|
|
532
|
+
break;
|
|
533
|
+
}
|
|
917
534
|
|
|
918
|
-
|
|
919
|
-
|
|
535
|
+
_context6.next = 4;
|
|
536
|
+
return _this4._getAllContents();
|
|
920
537
|
|
|
921
|
-
|
|
922
|
-
|
|
538
|
+
case 4:
|
|
539
|
+
LDS = _context6.sent;
|
|
923
540
|
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
541
|
+
case 5:
|
|
542
|
+
if (!(!LDS[objectKey] || LDS[objectKey].length === 0)) {
|
|
543
|
+
_context6.next = 7;
|
|
544
|
+
break;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
return _context6.abrupt("return", null);
|
|
548
|
+
|
|
549
|
+
case 7:
|
|
550
|
+
root = LDS[objectKey][0];
|
|
551
|
+
queue = [];
|
|
552
|
+
meta = {};
|
|
553
|
+
uniqueId = 0;
|
|
554
|
+
meta[uniqueId] = root;
|
|
555
|
+
queue.push(uniqueId);
|
|
556
|
+
|
|
557
|
+
while (queue.length !== 0) {
|
|
558
|
+
nodeId = queue.shift();
|
|
559
|
+
subTreeRoot = meta[nodeId];
|
|
929
560
|
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
subTreeRoot = meta[nodeId];
|
|
943
|
-
|
|
944
|
-
for (field in subTreeRoot) {
|
|
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
|
-
}
|
|
561
|
+
for (field in subTreeRoot) {
|
|
562
|
+
value = subTreeRoot[field];
|
|
563
|
+
|
|
564
|
+
if (value.__type && value.__type === 'Object') {
|
|
565
|
+
key = _this4.getKeyForObject(value);
|
|
566
|
+
|
|
567
|
+
if (LDS[key] && LDS[key].length > 0) {
|
|
568
|
+
pointer = LDS[key][0];
|
|
569
|
+
uniqueId++;
|
|
570
|
+
meta[uniqueId] = pointer;
|
|
571
|
+
subTreeRoot[field] = pointer;
|
|
572
|
+
queue.push(uniqueId);
|
|
957
573
|
}
|
|
958
574
|
}
|
|
959
575
|
}
|
|
576
|
+
}
|
|
960
577
|
|
|
961
|
-
|
|
578
|
+
return _context6.abrupt("return", root);
|
|
962
579
|
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
}
|
|
580
|
+
case 15:
|
|
581
|
+
case "end":
|
|
582
|
+
return _context6.stop();
|
|
967
583
|
}
|
|
968
584
|
}, _callee4);
|
|
969
585
|
}))();
|
|
970
586
|
},
|
|
971
587
|
// Called when an object is save / fetched
|
|
972
588
|
// Update object pin value
|
|
973
|
-
_updateObjectIfPinned: function
|
|
589
|
+
_updateObjectIfPinned: function (object
|
|
974
590
|
/*: ParseObject*/
|
|
975
591
|
)
|
|
976
592
|
/*: Promise<void>*/
|
|
977
593
|
{
|
|
978
594
|
var _this5 = this;
|
|
979
595
|
|
|
980
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
596
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
981
597
|
var objectKey, pinned;
|
|
982
|
-
return
|
|
983
|
-
while (1) {
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
}
|
|
598
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
599
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
600
|
+
case 0:
|
|
601
|
+
if (_this5.isEnabled) {
|
|
602
|
+
_context7.next = 2;
|
|
603
|
+
break;
|
|
604
|
+
}
|
|
990
605
|
|
|
991
|
-
|
|
606
|
+
return _context7.abrupt("return");
|
|
992
607
|
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
608
|
+
case 2:
|
|
609
|
+
objectKey = _this5.getKeyForObject(object);
|
|
610
|
+
_context7.next = 5;
|
|
611
|
+
return _this5.fromPinWithName(objectKey);
|
|
997
612
|
|
|
998
|
-
|
|
999
|
-
|
|
613
|
+
case 5:
|
|
614
|
+
pinned = _context7.sent;
|
|
1000
615
|
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
616
|
+
if (!(!pinned || pinned.length === 0)) {
|
|
617
|
+
_context7.next = 8;
|
|
618
|
+
break;
|
|
619
|
+
}
|
|
1005
620
|
|
|
1006
|
-
|
|
621
|
+
return _context7.abrupt("return");
|
|
1007
622
|
|
|
1008
|
-
|
|
1009
|
-
|
|
623
|
+
case 8:
|
|
624
|
+
return _context7.abrupt("return", _this5.pinWithName(objectKey, [object._toFullJSON()]));
|
|
1010
625
|
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
}
|
|
626
|
+
case 9:
|
|
627
|
+
case "end":
|
|
628
|
+
return _context7.stop();
|
|
1015
629
|
}
|
|
1016
630
|
}, _callee5);
|
|
1017
631
|
}))();
|
|
@@ -1019,142 +633,138 @@ var LocalDatastore = {
|
|
|
1019
633
|
// Called when object is destroyed
|
|
1020
634
|
// Unpin object and remove all references from pin names
|
|
1021
635
|
// TODO: Destroy children?
|
|
1022
|
-
_destroyObjectIfPinned: function
|
|
636
|
+
_destroyObjectIfPinned: function (object
|
|
1023
637
|
/*: ParseObject*/
|
|
1024
638
|
) {
|
|
1025
639
|
var _this6 = this;
|
|
1026
640
|
|
|
1027
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
641
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
1028
642
|
var localDatastore, objectKey, pin, promises, key, pinned;
|
|
1029
|
-
return
|
|
1030
|
-
while (1) {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
}
|
|
643
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
644
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
645
|
+
case 0:
|
|
646
|
+
if (_this6.isEnabled) {
|
|
647
|
+
_context8.next = 2;
|
|
648
|
+
break;
|
|
649
|
+
}
|
|
1037
650
|
|
|
1038
|
-
|
|
651
|
+
return _context8.abrupt("return");
|
|
1039
652
|
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
653
|
+
case 2:
|
|
654
|
+
_context8.next = 4;
|
|
655
|
+
return _this6._getAllContents();
|
|
1043
656
|
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
657
|
+
case 4:
|
|
658
|
+
localDatastore = _context8.sent;
|
|
659
|
+
objectKey = _this6.getKeyForObject(object);
|
|
660
|
+
pin = localDatastore[objectKey];
|
|
1048
661
|
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
662
|
+
if (pin) {
|
|
663
|
+
_context8.next = 9;
|
|
664
|
+
break;
|
|
665
|
+
}
|
|
1053
666
|
|
|
1054
|
-
|
|
667
|
+
return _context8.abrupt("return");
|
|
1055
668
|
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
669
|
+
case 9:
|
|
670
|
+
promises = [_this6.unPinWithName(objectKey)];
|
|
671
|
+
delete localDatastore[objectKey];
|
|
1059
672
|
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
673
|
+
for (key in localDatastore) {
|
|
674
|
+
if (key === _LocalDatastoreUtils.DEFAULT_PIN || (0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.PIN_PREFIX)) {
|
|
675
|
+
pinned = localDatastore[key] || [];
|
|
1063
676
|
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
677
|
+
if ((0, _includes.default)(pinned).call(pinned, objectKey)) {
|
|
678
|
+
pinned = (0, _filter.default)(pinned).call(pinned, function (item) {
|
|
679
|
+
return item !== objectKey;
|
|
680
|
+
});
|
|
1068
681
|
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
}
|
|
682
|
+
if (pinned.length == 0) {
|
|
683
|
+
promises.push(_this6.unPinWithName(key));
|
|
684
|
+
delete localDatastore[key];
|
|
685
|
+
} else {
|
|
686
|
+
promises.push(_this6.pinWithName(key, pinned));
|
|
687
|
+
localDatastore[key] = pinned;
|
|
1076
688
|
}
|
|
1077
689
|
}
|
|
1078
690
|
}
|
|
691
|
+
}
|
|
1079
692
|
|
|
1080
|
-
|
|
693
|
+
return _context8.abrupt("return", _promise.default.all(promises));
|
|
1081
694
|
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
}
|
|
695
|
+
case 13:
|
|
696
|
+
case "end":
|
|
697
|
+
return _context8.stop();
|
|
1086
698
|
}
|
|
1087
699
|
}, _callee6);
|
|
1088
700
|
}))();
|
|
1089
701
|
},
|
|
1090
702
|
// Update pin and references of the unsaved object
|
|
1091
|
-
_updateLocalIdForObject: function
|
|
703
|
+
_updateLocalIdForObject: function (localId
|
|
1092
704
|
/*: string*/
|
|
1093
705
|
, object
|
|
1094
706
|
/*: ParseObject*/
|
|
1095
707
|
) {
|
|
1096
708
|
var _this7 = this;
|
|
1097
709
|
|
|
1098
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
1099
|
-
var
|
|
710
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
711
|
+
var _context9, _context10;
|
|
1100
712
|
|
|
1101
713
|
var localKey, objectKey, unsaved, promises, localDatastore, key, pinned;
|
|
1102
|
-
return
|
|
1103
|
-
while (1) {
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
}
|
|
714
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
715
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
716
|
+
case 0:
|
|
717
|
+
if (_this7.isEnabled) {
|
|
718
|
+
_context11.next = 2;
|
|
719
|
+
break;
|
|
720
|
+
}
|
|
1110
721
|
|
|
1111
|
-
|
|
722
|
+
return _context11.abrupt("return");
|
|
1112
723
|
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
724
|
+
case 2:
|
|
725
|
+
localKey = (0, _concat.default)(_context9 = (0, _concat.default)(_context10 = "".concat(_LocalDatastoreUtils.OBJECT_PREFIX)).call(_context10, object.className, "_")).call(_context9, localId);
|
|
726
|
+
objectKey = _this7.getKeyForObject(object);
|
|
727
|
+
_context11.next = 6;
|
|
728
|
+
return _this7.fromPinWithName(localKey);
|
|
1118
729
|
|
|
1119
|
-
|
|
1120
|
-
|
|
730
|
+
case 6:
|
|
731
|
+
unsaved = _context11.sent;
|
|
1121
732
|
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
733
|
+
if (!(!unsaved || unsaved.length === 0)) {
|
|
734
|
+
_context11.next = 9;
|
|
735
|
+
break;
|
|
736
|
+
}
|
|
1126
737
|
|
|
1127
|
-
|
|
738
|
+
return _context11.abrupt("return");
|
|
1128
739
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
740
|
+
case 9:
|
|
741
|
+
promises = [_this7.unPinWithName(localKey), _this7.pinWithName(objectKey, unsaved)];
|
|
742
|
+
_context11.next = 12;
|
|
743
|
+
return _this7._getAllContents();
|
|
1133
744
|
|
|
1134
|
-
|
|
1135
|
-
|
|
745
|
+
case 12:
|
|
746
|
+
localDatastore = _context11.sent;
|
|
1136
747
|
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
748
|
+
for (key in localDatastore) {
|
|
749
|
+
if (key === _LocalDatastoreUtils.DEFAULT_PIN || (0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.PIN_PREFIX)) {
|
|
750
|
+
pinned = localDatastore[key] || [];
|
|
1140
751
|
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
}
|
|
752
|
+
if ((0, _includes.default)(pinned).call(pinned, localKey)) {
|
|
753
|
+
pinned = (0, _filter.default)(pinned).call(pinned, function (item) {
|
|
754
|
+
return item !== localKey;
|
|
755
|
+
});
|
|
756
|
+
pinned.push(objectKey);
|
|
757
|
+
promises.push(_this7.pinWithName(key, pinned));
|
|
758
|
+
localDatastore[key] = pinned;
|
|
1149
759
|
}
|
|
1150
760
|
}
|
|
761
|
+
}
|
|
1151
762
|
|
|
1152
|
-
|
|
763
|
+
return _context11.abrupt("return", _promise.default.all(promises));
|
|
1153
764
|
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
}
|
|
765
|
+
case 15:
|
|
766
|
+
case "end":
|
|
767
|
+
return _context11.stop();
|
|
1158
768
|
}
|
|
1159
769
|
}, _callee7);
|
|
1160
770
|
}))();
|
|
@@ -1171,143 +781,141 @@ var LocalDatastore = {
|
|
|
1171
781
|
* @name Parse.LocalDatastore.updateFromServer
|
|
1172
782
|
* @static
|
|
1173
783
|
*/
|
|
1174
|
-
updateFromServer: function
|
|
784
|
+
updateFromServer: function () {
|
|
1175
785
|
var _this8 = this;
|
|
1176
786
|
|
|
1177
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
1178
|
-
var
|
|
1179
|
-
|
|
1180
|
-
var localDatastore, keys, key, pointersHash, _i, _keys, _key, _key$split, _key$split2, className, objectId, queryPromises, responses, objects, pinPromises;
|
|
787
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
788
|
+
var _context12;
|
|
1181
789
|
|
|
1182
|
-
|
|
1183
|
-
while (1) {
|
|
1184
|
-
switch (_context15.prev = _context15.next) {
|
|
1185
|
-
case 0:
|
|
1186
|
-
if (!(!_this8.checkIfEnabled() || _this8.isSyncing)) {
|
|
1187
|
-
_context15.next = 2;
|
|
1188
|
-
break;
|
|
1189
|
-
}
|
|
790
|
+
var localDatastore, keys, key, pointersHash, _i, _keys, _key, _key$split3, _key$split4, className, objectId, queryPromises, responses, objects, pinPromises;
|
|
1190
791
|
|
|
1191
|
-
|
|
792
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
793
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
794
|
+
case 0:
|
|
795
|
+
if (!(!_this8.checkIfEnabled() || _this8.isSyncing)) {
|
|
796
|
+
_context13.next = 2;
|
|
797
|
+
break;
|
|
798
|
+
}
|
|
1192
799
|
|
|
1193
|
-
|
|
1194
|
-
_context15.next = 4;
|
|
1195
|
-
return _this8._getAllContents();
|
|
800
|
+
return _context13.abrupt("return");
|
|
1196
801
|
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
802
|
+
case 2:
|
|
803
|
+
_context13.next = 4;
|
|
804
|
+
return _this8._getAllContents();
|
|
1200
805
|
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
806
|
+
case 4:
|
|
807
|
+
localDatastore = _context13.sent;
|
|
808
|
+
keys = [];
|
|
1206
809
|
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
810
|
+
for (key in localDatastore) {
|
|
811
|
+
if ((0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.OBJECT_PREFIX)) {
|
|
812
|
+
keys.push(key);
|
|
1210
813
|
}
|
|
814
|
+
}
|
|
1211
815
|
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
pointersHash = {};
|
|
1217
|
-
_i = 0, _keys = keys;
|
|
816
|
+
if (!(keys.length === 0)) {
|
|
817
|
+
_context13.next = 9;
|
|
818
|
+
break;
|
|
819
|
+
}
|
|
1218
820
|
|
|
1219
|
-
|
|
1220
|
-
if (!(_i < _keys.length)) {
|
|
1221
|
-
_context15.next = 23;
|
|
1222
|
-
break;
|
|
1223
|
-
}
|
|
821
|
+
return _context13.abrupt("return");
|
|
1224
822
|
|
|
1225
|
-
|
|
823
|
+
case 9:
|
|
824
|
+
_this8.isSyncing = true;
|
|
825
|
+
pointersHash = {};
|
|
826
|
+
_i = 0, _keys = keys;
|
|
1226
827
|
|
|
1227
|
-
|
|
828
|
+
case 12:
|
|
829
|
+
if (!(_i < _keys.length)) {
|
|
830
|
+
_context13.next = 23;
|
|
831
|
+
break;
|
|
832
|
+
}
|
|
1228
833
|
|
|
1229
|
-
|
|
1230
|
-
className = '_User';
|
|
1231
|
-
objectId = _key.split('_')[4];
|
|
1232
|
-
}
|
|
834
|
+
_key = _keys[_i]; // Ignore the OBJECT_PREFIX
|
|
1233
835
|
|
|
1234
|
-
|
|
1235
|
-
_context15.next = 18;
|
|
1236
|
-
break;
|
|
1237
|
-
}
|
|
836
|
+
_key$split3 = _key.split('_'), _key$split4 = (0, _slicedToArray2.default)(_key$split3, 4), className = _key$split4[2], objectId = _key$split4[3]; // User key is split into [ 'Parse', 'LDS', '', 'User', 'objectId' ]
|
|
1238
837
|
|
|
1239
|
-
|
|
838
|
+
if (_key.split('_').length === 5 && _key.split('_')[3] === 'User') {
|
|
839
|
+
className = '_User';
|
|
840
|
+
objectId = _key.split('_')[4];
|
|
841
|
+
}
|
|
1240
842
|
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
843
|
+
if (!(0, _startsWith.default)(objectId).call(objectId, 'local')) {
|
|
844
|
+
_context13.next = 18;
|
|
845
|
+
break;
|
|
846
|
+
}
|
|
1245
847
|
|
|
1246
|
-
|
|
848
|
+
return _context13.abrupt("continue", 20);
|
|
1247
849
|
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
850
|
+
case 18:
|
|
851
|
+
if (!(className in pointersHash)) {
|
|
852
|
+
pointersHash[className] = new _set.default();
|
|
853
|
+
}
|
|
1252
854
|
|
|
1253
|
-
|
|
1254
|
-
queryPromises = (0, _map.default)(_context14 = (0, _keys3.default)(pointersHash)).call(_context14, function (className) {
|
|
1255
|
-
var objectIds = (0, _from.default)(pointersHash[className]);
|
|
1256
|
-
var query = new _ParseQuery.default(className);
|
|
1257
|
-
query.limit(objectIds.length);
|
|
855
|
+
pointersHash[className].add(objectId);
|
|
1258
856
|
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
}
|
|
857
|
+
case 20:
|
|
858
|
+
_i++;
|
|
859
|
+
_context13.next = 12;
|
|
860
|
+
break;
|
|
1264
861
|
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
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;
|
|
1285
|
-
break;
|
|
862
|
+
case 23:
|
|
863
|
+
queryPromises = (0, _map.default)(_context12 = (0, _keys2.default)(pointersHash)).call(_context12, function (className) {
|
|
864
|
+
var objectIds = (0, _from.default)(pointersHash[className]);
|
|
865
|
+
var query = new _ParseQuery.default(className);
|
|
866
|
+
query.limit(objectIds.length);
|
|
1286
867
|
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
868
|
+
if (objectIds.length === 1) {
|
|
869
|
+
query.equalTo('objectId', objectIds[0]);
|
|
870
|
+
} else {
|
|
871
|
+
query.containedIn('objectId', objectIds);
|
|
872
|
+
}
|
|
1292
873
|
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
874
|
+
return (0, _find.default)(query).call(query);
|
|
875
|
+
});
|
|
876
|
+
_context13.prev = 24;
|
|
877
|
+
_context13.next = 27;
|
|
878
|
+
return _promise.default.all(queryPromises);
|
|
879
|
+
|
|
880
|
+
case 27:
|
|
881
|
+
responses = _context13.sent;
|
|
882
|
+
objects = (0, _concat.default)([]).apply([], responses);
|
|
883
|
+
pinPromises = (0, _map.default)(objects).call(objects, function (object) {
|
|
884
|
+
var objectKey = _this8.getKeyForObject(object);
|
|
885
|
+
|
|
886
|
+
return _this8.pinWithName(objectKey, object._toFullJSON());
|
|
887
|
+
});
|
|
888
|
+
_context13.next = 32;
|
|
889
|
+
return _promise.default.all(pinPromises);
|
|
890
|
+
|
|
891
|
+
case 32:
|
|
892
|
+
_this8.isSyncing = false;
|
|
893
|
+
_context13.next = 39;
|
|
894
|
+
break;
|
|
895
|
+
|
|
896
|
+
case 35:
|
|
897
|
+
_context13.prev = 35;
|
|
898
|
+
_context13.t0 = _context13["catch"](24);
|
|
899
|
+
console.error('Error syncing LocalDatastore: ', _context13.t0);
|
|
900
|
+
_this8.isSyncing = false;
|
|
901
|
+
|
|
902
|
+
case 39:
|
|
903
|
+
case "end":
|
|
904
|
+
return _context13.stop();
|
|
1297
905
|
}
|
|
1298
906
|
}, _callee8, null, [[24, 35]]);
|
|
1299
907
|
}))();
|
|
1300
908
|
},
|
|
1301
|
-
getKeyForObject: function
|
|
909
|
+
getKeyForObject: function (object
|
|
1302
910
|
/*: any*/
|
|
1303
911
|
) {
|
|
1304
|
-
var
|
|
912
|
+
var _context14, _context15;
|
|
1305
913
|
|
|
1306
914
|
var objectId = object.objectId || object._getId();
|
|
1307
915
|
|
|
1308
|
-
return (0, _concat.default)(
|
|
916
|
+
return (0, _concat.default)(_context14 = (0, _concat.default)(_context15 = "".concat(_LocalDatastoreUtils.OBJECT_PREFIX)).call(_context15, object.className, "_")).call(_context14, objectId);
|
|
1309
917
|
},
|
|
1310
|
-
getPinName: function
|
|
918
|
+
getPinName: function (pinName
|
|
1311
919
|
/*: ?string*/
|
|
1312
920
|
) {
|
|
1313
921
|
if (!pinName || pinName === _LocalDatastoreUtils.DEFAULT_PIN) {
|
|
@@ -1316,7 +924,7 @@ var LocalDatastore = {
|
|
|
1316
924
|
|
|
1317
925
|
return _LocalDatastoreUtils.PIN_PREFIX + pinName;
|
|
1318
926
|
},
|
|
1319
|
-
checkIfEnabled: function
|
|
927
|
+
checkIfEnabled: function () {
|
|
1320
928
|
if (!this.isEnabled) {
|
|
1321
929
|
console.error('Parse.enableLocalDatastore() must be called first');
|
|
1322
930
|
}
|