parse 4.0.0-alpha.6 → 4.0.0-alpha.8

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.
Files changed (197) hide show
  1. package/LICENSE +167 -25
  2. package/NOTICE +10 -0
  3. package/README.md +1 -3
  4. package/dist/parse.js +3991 -6551
  5. package/dist/parse.min.js +7 -6
  6. package/dist/parse.weapp.js +3152 -6482
  7. package/dist/parse.weapp.min.js +7 -6
  8. package/lib/browser/Analytics.js +4 -11
  9. package/lib/browser/AnonymousUtils.js +2 -9
  10. package/lib/browser/Cloud.js +4 -11
  11. package/lib/browser/CloudCode.js +0 -1
  12. package/lib/browser/CoreManager.js +3 -10
  13. package/lib/browser/EventEmitter.js +0 -7
  14. package/lib/browser/EventuallyQueue.js +282 -668
  15. package/lib/browser/FacebookUtils.js +2 -9
  16. package/lib/browser/InstallationController.js +0 -7
  17. package/lib/browser/LiveQueryClient.js +35 -26
  18. package/lib/browser/LiveQuerySubscription.js +5 -4
  19. package/lib/browser/LocalDatastore.js +472 -864
  20. package/lib/browser/LocalDatastoreController.js +161 -547
  21. package/lib/browser/LocalDatastoreController.react-native.js +156 -537
  22. package/lib/browser/LocalDatastoreUtils.js +2 -9
  23. package/lib/browser/ObjectStateMutations.js +25 -25
  24. package/lib/browser/OfflineQuery.js +31 -33
  25. package/lib/browser/Parse.js +4 -13
  26. package/lib/browser/ParseACL.js +9 -16
  27. package/lib/browser/ParseCLP.js +46 -48
  28. package/lib/browser/ParseConfig.js +6 -13
  29. package/lib/browser/ParseError.js +2 -11
  30. package/lib/browser/ParseFile.js +107 -482
  31. package/lib/browser/ParseGeoPoint.js +4 -11
  32. package/lib/browser/ParseHooks.js +2 -2
  33. package/lib/browser/ParseInstallation.js +2 -2
  34. package/lib/browser/ParseLiveQuery.js +104 -480
  35. package/lib/browser/ParseObject.js +598 -958
  36. package/lib/browser/ParseOp.js +11 -11
  37. package/lib/browser/ParsePolygon.js +5 -12
  38. package/lib/browser/ParseQuery.js +365 -758
  39. package/lib/browser/ParseRelation.js +2 -9
  40. package/lib/browser/ParseRole.js +2 -2
  41. package/lib/browser/ParseSchema.js +2 -9
  42. package/lib/browser/ParseSession.js +2 -2
  43. package/lib/browser/ParseUser.js +221 -607
  44. package/lib/browser/Push.js +2 -9
  45. package/lib/browser/RESTController.js +12 -19
  46. package/lib/browser/SingleInstanceStateController.js +4 -11
  47. package/lib/browser/Storage.js +0 -7
  48. package/lib/browser/StorageController.browser.js +0 -7
  49. package/lib/browser/StorageController.default.js +0 -7
  50. package/lib/browser/StorageController.react-native.js +0 -7
  51. package/lib/browser/StorageController.weapp.js +0 -7
  52. package/lib/browser/TaskQueue.js +0 -7
  53. package/lib/browser/UniqueInstanceStateController.js +8 -15
  54. package/lib/browser/arrayContainsObject.js +2 -9
  55. package/lib/browser/canBeSerialized.js +2 -9
  56. package/lib/browser/decode.js +4 -11
  57. package/lib/browser/encode.js +8 -15
  58. package/lib/browser/equals.js +4 -13
  59. package/lib/browser/escape.js +0 -7
  60. package/lib/browser/isRevocableSession.js +2 -9
  61. package/lib/browser/parseDate.js +2 -9
  62. package/lib/browser/promiseUtils.js +4 -4
  63. package/lib/browser/unique.js +4 -11
  64. package/lib/browser/unsavedChildren.js +6 -13
  65. package/lib/browser/uuid.js +5 -1
  66. package/lib/node/Analytics.js +0 -7
  67. package/lib/node/AnonymousUtils.js +0 -7
  68. package/lib/node/Cloud.js +0 -7
  69. package/lib/node/CloudCode.js +0 -1
  70. package/lib/node/CoreManager.js +1 -8
  71. package/lib/node/EventEmitter.js +0 -7
  72. package/lib/node/FacebookUtils.js +0 -7
  73. package/lib/node/InstallationController.js +0 -7
  74. package/lib/node/LiveQueryClient.js +18 -17
  75. package/lib/node/LiveQuerySubscription.js +2 -11
  76. package/lib/node/LocalDatastore.js +0 -7
  77. package/lib/node/LocalDatastoreController.js +0 -7
  78. package/lib/node/LocalDatastoreController.react-native.js +0 -7
  79. package/lib/node/LocalDatastoreUtils.js +0 -7
  80. package/lib/node/ObjectStateMutations.js +0 -7
  81. package/lib/node/Parse.js +0 -9
  82. package/lib/node/ParseACL.js +0 -7
  83. package/lib/node/ParseCLP.js +0 -7
  84. package/lib/node/ParseConfig.js +0 -7
  85. package/lib/node/ParseError.js +0 -9
  86. package/lib/node/ParseFile.js +7 -12
  87. package/lib/node/ParseGeoPoint.js +0 -7
  88. package/lib/node/ParseInstallation.js +0 -7
  89. package/lib/node/ParseLiveQuery.js +0 -7
  90. package/lib/node/ParseObject.js +45 -34
  91. package/lib/node/ParseOp.js +0 -7
  92. package/lib/node/ParsePolygon.js +0 -7
  93. package/lib/node/ParseQuery.js +3 -18
  94. package/lib/node/ParseRelation.js +0 -7
  95. package/lib/node/ParseRole.js +0 -7
  96. package/lib/node/ParseSchema.js +0 -7
  97. package/lib/node/ParseSession.js +0 -7
  98. package/lib/node/ParseUser.js +0 -7
  99. package/lib/node/Push.js +0 -7
  100. package/lib/node/RESTController.js +0 -7
  101. package/lib/node/SingleInstanceStateController.js +0 -7
  102. package/lib/node/Storage.js +0 -7
  103. package/lib/node/StorageController.browser.js +0 -7
  104. package/lib/node/StorageController.default.js +0 -7
  105. package/lib/node/StorageController.react-native.js +0 -7
  106. package/lib/node/StorageController.weapp.js +0 -7
  107. package/lib/node/TaskQueue.js +0 -7
  108. package/lib/node/UniqueInstanceStateController.js +0 -7
  109. package/lib/node/arrayContainsObject.js +0 -7
  110. package/lib/node/canBeSerialized.js +0 -7
  111. package/lib/node/decode.js +0 -7
  112. package/lib/node/encode.js +0 -7
  113. package/lib/node/equals.js +0 -9
  114. package/lib/node/escape.js +0 -7
  115. package/lib/node/isRevocableSession.js +0 -7
  116. package/lib/node/parseDate.js +0 -7
  117. package/lib/node/unique.js +0 -7
  118. package/lib/node/unsavedChildren.js +0 -7
  119. package/lib/node/uuid.js +7 -1
  120. package/lib/react-native/CoreManager.js +2 -2
  121. package/lib/react-native/EventuallyQueue.js +169 -676
  122. package/lib/react-native/LiveQueryClient.js +16 -50
  123. package/lib/react-native/LiveQuerySubscription.js +3 -2
  124. package/lib/react-native/LocalDatastore.js +303 -863
  125. package/lib/react-native/LocalDatastoreController.js +75 -535
  126. package/lib/react-native/LocalDatastoreController.react-native.js +95 -503
  127. package/lib/react-native/ObjectStateMutations.js +2 -31
  128. package/lib/react-native/OfflineQuery.js +17 -63
  129. package/lib/react-native/ParseCLP.js +55 -129
  130. package/lib/react-native/ParseFile.js +63 -468
  131. package/lib/react-native/ParseLiveQuery.js +60 -455
  132. package/lib/react-native/ParseObject.js +263 -897
  133. package/lib/react-native/ParseQuery.js +207 -643
  134. package/lib/react-native/ParseSchema.js +3 -3
  135. package/lib/react-native/ParseUser.js +118 -573
  136. package/lib/react-native/RESTController.js +1 -29
  137. package/lib/react-native/uuid.js +5 -1
  138. package/lib/weapp/Analytics.js +4 -11
  139. package/lib/weapp/AnonymousUtils.js +2 -9
  140. package/lib/weapp/Cloud.js +4 -11
  141. package/lib/weapp/CloudCode.js +0 -1
  142. package/lib/weapp/CoreManager.js +3 -10
  143. package/lib/weapp/EventEmitter.js +0 -7
  144. package/lib/weapp/EventuallyQueue.js +282 -668
  145. package/lib/weapp/FacebookUtils.js +2 -9
  146. package/lib/weapp/InstallationController.js +0 -7
  147. package/lib/weapp/LiveQueryClient.js +35 -26
  148. package/lib/weapp/LiveQuerySubscription.js +5 -4
  149. package/lib/weapp/LocalDatastore.js +472 -864
  150. package/lib/weapp/LocalDatastoreController.js +161 -547
  151. package/lib/weapp/LocalDatastoreController.react-native.js +156 -537
  152. package/lib/weapp/LocalDatastoreUtils.js +2 -9
  153. package/lib/weapp/ObjectStateMutations.js +25 -25
  154. package/lib/weapp/OfflineQuery.js +31 -33
  155. package/lib/weapp/Parse.js +4 -13
  156. package/lib/weapp/ParseACL.js +9 -16
  157. package/lib/weapp/ParseCLP.js +46 -48
  158. package/lib/weapp/ParseConfig.js +6 -13
  159. package/lib/weapp/ParseError.js +2 -11
  160. package/lib/weapp/ParseFile.js +107 -482
  161. package/lib/weapp/ParseGeoPoint.js +4 -11
  162. package/lib/weapp/ParseHooks.js +2 -2
  163. package/lib/weapp/ParseInstallation.js +2 -2
  164. package/lib/weapp/ParseLiveQuery.js +104 -480
  165. package/lib/weapp/ParseObject.js +598 -958
  166. package/lib/weapp/ParseOp.js +11 -11
  167. package/lib/weapp/ParsePolygon.js +5 -12
  168. package/lib/weapp/ParseQuery.js +365 -758
  169. package/lib/weapp/ParseRelation.js +2 -9
  170. package/lib/weapp/ParseRole.js +2 -2
  171. package/lib/weapp/ParseSchema.js +2 -9
  172. package/lib/weapp/ParseSession.js +2 -2
  173. package/lib/weapp/ParseUser.js +221 -607
  174. package/lib/weapp/Push.js +2 -9
  175. package/lib/weapp/RESTController.js +12 -19
  176. package/lib/weapp/SingleInstanceStateController.js +4 -11
  177. package/lib/weapp/Storage.js +0 -7
  178. package/lib/weapp/StorageController.browser.js +0 -7
  179. package/lib/weapp/StorageController.default.js +0 -7
  180. package/lib/weapp/StorageController.react-native.js +0 -7
  181. package/lib/weapp/StorageController.weapp.js +0 -7
  182. package/lib/weapp/TaskQueue.js +0 -7
  183. package/lib/weapp/UniqueInstanceStateController.js +8 -15
  184. package/lib/weapp/arrayContainsObject.js +2 -9
  185. package/lib/weapp/canBeSerialized.js +2 -9
  186. package/lib/weapp/decode.js +4 -11
  187. package/lib/weapp/encode.js +8 -15
  188. package/lib/weapp/equals.js +4 -13
  189. package/lib/weapp/escape.js +0 -7
  190. package/lib/weapp/isRevocableSession.js +2 -9
  191. package/lib/weapp/parseDate.js +2 -9
  192. package/lib/weapp/promiseUtils.js +4 -4
  193. package/lib/weapp/unique.js +4 -11
  194. package/lib/weapp/unsavedChildren.js +6 -13
  195. package/lib/weapp/uuid.js +2 -0
  196. package/package.json +24 -24
  197. package/PATENTS +0 -37
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
+
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
11
 
10
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
13
 
@@ -99,423 +101,6 @@ function _interopRequireWildcard(obj, nodeInterop) {
99
101
  return newObj;
100
102
  }
101
103
 
102
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
103
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
104
- if (it) return (it = it.call(o)).next.bind(it);
105
-
106
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
107
- if (it) o = it;
108
- var i = 0;
109
- return function () {
110
- if (i >= o.length) return {
111
- done: true
112
- };
113
- return {
114
- done: false,
115
- value: o[i++]
116
- };
117
- };
118
- }
119
-
120
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
121
- }
122
-
123
- function _unsupportedIterableToArray(o, minLen) {
124
- if (!o) return;
125
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
126
- var n = Object.prototype.toString.call(o).slice(8, -1);
127
- if (n === "Object" && o.constructor) n = o.constructor.name;
128
- if (n === "Map" || n === "Set") return Array.from(o);
129
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
130
- }
131
-
132
- function _arrayLikeToArray(arr, len) {
133
- if (len == null || len > arr.length) len = arr.length;
134
-
135
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
136
- arr2[i] = arr[i];
137
- }
138
-
139
- return arr2;
140
- }
141
-
142
- function _regeneratorRuntime() {
143
- "use strict";
144
-
145
- _regeneratorRuntime = function () {
146
- return exports;
147
- };
148
-
149
- var exports = {},
150
- Op = Object.prototype,
151
- hasOwn = Op.hasOwnProperty,
152
- $Symbol = "function" == typeof Symbol ? Symbol : {},
153
- iteratorSymbol = $Symbol.iterator || "@@iterator",
154
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
155
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
156
-
157
- function define(obj, key, value) {
158
- return Object.defineProperty(obj, key, {
159
- value: value,
160
- enumerable: !0,
161
- configurable: !0,
162
- writable: !0
163
- }), obj[key];
164
- }
165
-
166
- try {
167
- define({}, "");
168
- } catch (err) {
169
- define = function (obj, key, value) {
170
- return obj[key] = value;
171
- };
172
- }
173
-
174
- function wrap(innerFn, outerFn, self, tryLocsList) {
175
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
176
- generator = Object.create(protoGenerator.prototype),
177
- context = new Context(tryLocsList || []);
178
- return generator._invoke = function (innerFn, self, context) {
179
- var state = "suspendedStart";
180
- return function (method, arg) {
181
- if ("executing" === state) throw new Error("Generator is already running");
182
-
183
- if ("completed" === state) {
184
- if ("throw" === method) throw arg;
185
- return doneResult();
186
- }
187
-
188
- for (context.method = method, context.arg = arg;;) {
189
- var delegate = context.delegate;
190
-
191
- if (delegate) {
192
- var delegateResult = maybeInvokeDelegate(delegate, context);
193
-
194
- if (delegateResult) {
195
- if (delegateResult === ContinueSentinel) continue;
196
- return delegateResult;
197
- }
198
- }
199
-
200
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
201
- if ("suspendedStart" === state) throw state = "completed", context.arg;
202
- context.dispatchException(context.arg);
203
- } else "return" === context.method && context.abrupt("return", context.arg);
204
- state = "executing";
205
- var record = tryCatch(innerFn, self, context);
206
-
207
- if ("normal" === record.type) {
208
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
209
- return {
210
- value: record.arg,
211
- done: context.done
212
- };
213
- }
214
-
215
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
216
- }
217
- };
218
- }(innerFn, self, context), generator;
219
- }
220
-
221
- function tryCatch(fn, obj, arg) {
222
- try {
223
- return {
224
- type: "normal",
225
- arg: fn.call(obj, arg)
226
- };
227
- } catch (err) {
228
- return {
229
- type: "throw",
230
- arg: err
231
- };
232
- }
233
- }
234
-
235
- exports.wrap = wrap;
236
- var ContinueSentinel = {};
237
-
238
- function Generator() {}
239
-
240
- function GeneratorFunction() {}
241
-
242
- function GeneratorFunctionPrototype() {}
243
-
244
- var IteratorPrototype = {};
245
- define(IteratorPrototype, iteratorSymbol, function () {
246
- return this;
247
- });
248
- var getProto = Object.getPrototypeOf,
249
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
250
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
251
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
252
-
253
- function defineIteratorMethods(prototype) {
254
- ["next", "throw", "return"].forEach(function (method) {
255
- define(prototype, method, function (arg) {
256
- return this._invoke(method, arg);
257
- });
258
- });
259
- }
260
-
261
- function AsyncIterator(generator, PromiseImpl) {
262
- function invoke(method, arg, resolve, reject) {
263
- var record = tryCatch(generator[method], generator, arg);
264
-
265
- if ("throw" !== record.type) {
266
- var result = record.arg,
267
- value = result.value;
268
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
269
- invoke("next", value, resolve, reject);
270
- }, function (err) {
271
- invoke("throw", err, resolve, reject);
272
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
273
- result.value = unwrapped, resolve(result);
274
- }, function (error) {
275
- return invoke("throw", error, resolve, reject);
276
- });
277
- }
278
-
279
- reject(record.arg);
280
- }
281
-
282
- var previousPromise;
283
-
284
- this._invoke = function (method, arg) {
285
- function callInvokeWithMethodAndArg() {
286
- return new PromiseImpl(function (resolve, reject) {
287
- invoke(method, arg, resolve, reject);
288
- });
289
- }
290
-
291
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
292
- };
293
- }
294
-
295
- function maybeInvokeDelegate(delegate, context) {
296
- var method = delegate.iterator[context.method];
297
-
298
- if (undefined === method) {
299
- if (context.delegate = null, "throw" === context.method) {
300
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
301
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
302
- }
303
-
304
- return ContinueSentinel;
305
- }
306
-
307
- var record = tryCatch(method, delegate.iterator, context.arg);
308
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
309
- var info = record.arg;
310
- 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);
311
- }
312
-
313
- function pushTryEntry(locs) {
314
- var entry = {
315
- tryLoc: locs[0]
316
- };
317
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
318
- }
319
-
320
- function resetTryEntry(entry) {
321
- var record = entry.completion || {};
322
- record.type = "normal", delete record.arg, entry.completion = record;
323
- }
324
-
325
- function Context(tryLocsList) {
326
- this.tryEntries = [{
327
- tryLoc: "root"
328
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
329
- }
330
-
331
- function values(iterable) {
332
- if (iterable) {
333
- var iteratorMethod = iterable[iteratorSymbol];
334
- if (iteratorMethod) return iteratorMethod.call(iterable);
335
- if ("function" == typeof iterable.next) return iterable;
336
-
337
- if (!isNaN(iterable.length)) {
338
- var i = -1,
339
- next = function next() {
340
- for (; ++i < iterable.length;) {
341
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
342
- }
343
-
344
- return next.value = undefined, next.done = !0, next;
345
- };
346
-
347
- return next.next = next;
348
- }
349
- }
350
-
351
- return {
352
- next: doneResult
353
- };
354
- }
355
-
356
- function doneResult() {
357
- return {
358
- value: undefined,
359
- done: !0
360
- };
361
- }
362
-
363
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
364
- var ctor = "function" == typeof genFun && genFun.constructor;
365
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
366
- }, exports.mark = function (genFun) {
367
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
368
- }, exports.awrap = function (arg) {
369
- return {
370
- __await: arg
371
- };
372
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
373
- return this;
374
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
375
- void 0 === PromiseImpl && (PromiseImpl = Promise);
376
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
377
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
378
- return result.done ? result.value : iter.next();
379
- });
380
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
381
- return this;
382
- }), define(Gp, "toString", function () {
383
- return "[object Generator]";
384
- }), exports.keys = function (object) {
385
- var keys = [];
386
-
387
- for (var key in object) {
388
- keys.push(key);
389
- }
390
-
391
- return keys.reverse(), function next() {
392
- for (; keys.length;) {
393
- var key = keys.pop();
394
- if (key in object) return next.value = key, next.done = !1, next;
395
- }
396
-
397
- return next.done = !0, next;
398
- };
399
- }, exports.values = values, Context.prototype = {
400
- constructor: Context,
401
- reset: function (skipTempReset) {
402
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
403
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
404
- }
405
- },
406
- stop: function () {
407
- this.done = !0;
408
- var rootRecord = this.tryEntries[0].completion;
409
- if ("throw" === rootRecord.type) throw rootRecord.arg;
410
- return this.rval;
411
- },
412
- dispatchException: function (exception) {
413
- if (this.done) throw exception;
414
- var context = this;
415
-
416
- function handle(loc, caught) {
417
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
418
- }
419
-
420
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
421
- var entry = this.tryEntries[i],
422
- record = entry.completion;
423
- if ("root" === entry.tryLoc) return handle("end");
424
-
425
- if (entry.tryLoc <= this.prev) {
426
- var hasCatch = hasOwn.call(entry, "catchLoc"),
427
- hasFinally = hasOwn.call(entry, "finallyLoc");
428
-
429
- if (hasCatch && hasFinally) {
430
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
431
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
432
- } else if (hasCatch) {
433
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
434
- } else {
435
- if (!hasFinally) throw new Error("try statement without catch or finally");
436
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
437
- }
438
- }
439
- }
440
- },
441
- abrupt: function (type, arg) {
442
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
443
- var entry = this.tryEntries[i];
444
-
445
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
446
- var finallyEntry = entry;
447
- break;
448
- }
449
- }
450
-
451
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
452
- var record = finallyEntry ? finallyEntry.completion : {};
453
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
454
- },
455
- complete: function (record, afterLoc) {
456
- if ("throw" === record.type) throw record.arg;
457
- 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;
458
- },
459
- finish: function (finallyLoc) {
460
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
461
- var entry = this.tryEntries[i];
462
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
463
- }
464
- },
465
- catch: function (tryLoc) {
466
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
467
- var entry = this.tryEntries[i];
468
-
469
- if (entry.tryLoc === tryLoc) {
470
- var record = entry.completion;
471
-
472
- if ("throw" === record.type) {
473
- var thrown = record.arg;
474
- resetTryEntry(entry);
475
- }
476
-
477
- return thrown;
478
- }
479
- }
480
-
481
- throw new Error("illegal catch attempt");
482
- },
483
- delegateYield: function (iterable, resultName, nextLoc) {
484
- return this.delegate = {
485
- iterator: values(iterable),
486
- resultName: resultName,
487
- nextLoc: nextLoc
488
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
489
- }
490
- }, exports;
491
- }
492
-
493
- function ownKeys(object, enumerableOnly) {
494
- var keys = Object.keys(object);
495
-
496
- if (Object.getOwnPropertySymbols) {
497
- var symbols = Object.getOwnPropertySymbols(object);
498
- enumerableOnly && (symbols = symbols.filter(function (sym) {
499
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
500
- })), keys.push.apply(keys, symbols);
501
- }
502
-
503
- return keys;
504
- }
505
-
506
- function _objectSpread(target) {
507
- for (var i = 1; i < arguments.length; i++) {
508
- var source = null != arguments[i] ? arguments[i] : {};
509
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
510
- (0, _defineProperty2.default)(target, key, source[key]);
511
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
512
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
513
- });
514
- }
515
-
516
- return target;
517
- }
518
-
519
104
  var uuidv4 = require('./uuid');
520
105
 
521
106
  var classMap = {};
@@ -863,7 +448,7 @@ var ParseObject = function () {
863
448
  var val = (0, _decode.default)(response[attr]);
864
449
 
865
450
  if (val && Object.getPrototypeOf(val) === Object.prototype) {
866
- changes[attr] = _objectSpread(_objectSpread({}, this.attributes[attr]), val);
451
+ changes[attr] = Object.assign({}, this.attributes[attr], val);
867
452
  } else {
868
453
  changes[attr] = val;
869
454
  }
@@ -1304,49 +889,31 @@ var ParseObject = function () {
1304
889
  }
1305
890
  }, {
1306
891
  key: "exists",
1307
- value: function (options) {
1308
- var query;
1309
- return _regeneratorRuntime().async(function (_context) {
1310
- while (1) {
1311
- switch (_context.prev = _context.next) {
1312
- case 0:
1313
- if (this.id) {
1314
- _context.next = 2;
1315
- break;
1316
- }
1317
-
1318
- return _context.abrupt("return", false);
1319
-
1320
- case 2:
1321
- _context.prev = 2;
1322
- query = new _ParseQuery.default(this.className);
1323
- _context.next = 6;
1324
- return _regeneratorRuntime().awrap(query.get(this.id, options));
1325
-
1326
- case 6:
1327
- return _context.abrupt("return", true);
1328
-
1329
- case 9:
1330
- _context.prev = 9;
1331
- _context.t0 = _context["catch"](2);
892
+ value: function () {
893
+ var _exists = (0, _asyncToGenerator2.default)(function* (options) {
894
+ if (!this.id) {
895
+ return false;
896
+ }
1332
897
 
1333
- if (!(_context.t0.code === _ParseError.default.OBJECT_NOT_FOUND)) {
1334
- _context.next = 13;
1335
- break;
1336
- }
898
+ try {
899
+ var query = new _ParseQuery.default(this.className);
900
+ yield query.get(this.id, options);
901
+ return true;
902
+ } catch (e) {
903
+ if (e.code === _ParseError.default.OBJECT_NOT_FOUND) {
904
+ return false;
905
+ }
1337
906
 
1338
- return _context.abrupt("return", false);
907
+ throw e;
908
+ }
909
+ });
1339
910
 
1340
- case 13:
1341
- throw _context.t0;
911
+ function exists() {
912
+ return _exists.apply(this, arguments);
913
+ }
1342
914
 
1343
- case 14:
1344
- case "end":
1345
- return _context.stop();
1346
- }
1347
- }
1348
- }, null, this, [[2, 9]], Promise);
1349
- }
915
+ return exists;
916
+ }()
1350
917
  }, {
1351
918
  key: "isValid",
1352
919
  value: function () {
@@ -1395,9 +962,7 @@ var ParseObject = function () {
1395
962
  if (keys.length) {
1396
963
  keysToRevert = [];
1397
964
 
1398
- for (var _iterator = _createForOfIteratorHelperLoose(keys), _step; !(_step = _iterator()).done;) {
1399
- var _key3 = _step.value;
1400
-
965
+ for (var _key3 of keys) {
1401
966
  if (typeof _key3 === 'string') {
1402
967
  keysToRevert.push(_key3);
1403
968
  } else {
@@ -1476,44 +1041,27 @@ var ParseObject = function () {
1476
1041
  }
1477
1042
  }, {
1478
1043
  key: "saveEventually",
1479
- value: function (options) {
1480
- return _regeneratorRuntime().async(function (_context2) {
1481
- while (1) {
1482
- switch (_context2.prev = _context2.next) {
1483
- case 0:
1484
- _context2.prev = 0;
1485
- _context2.next = 3;
1486
- return _regeneratorRuntime().awrap(this.save(null, options));
1487
-
1488
- case 3:
1489
- _context2.next = 11;
1490
- break;
1491
-
1492
- case 5:
1493
- _context2.prev = 5;
1494
- _context2.t0 = _context2["catch"](0);
1495
-
1496
- if (!(_context2.t0.message === 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
1497
- _context2.next = 11;
1498
- break;
1499
- }
1500
-
1501
- _context2.next = 10;
1502
- return _regeneratorRuntime().awrap(_EventuallyQueue.default.save(this, options));
1044
+ value: function () {
1045
+ var _saveEventually = (0, _asyncToGenerator2.default)(function* (options) {
1046
+ try {
1047
+ yield this.save(null, options);
1048
+ } catch (e) {
1049
+ if (e.message === 'XMLHttpRequest failed: "Unable to connect to the Parse API"') {
1050
+ yield _EventuallyQueue.default.save(this, options);
1051
+
1052
+ _EventuallyQueue.default.poll();
1053
+ }
1054
+ }
1503
1055
 
1504
- case 10:
1505
- _EventuallyQueue.default.poll();
1056
+ return this;
1057
+ });
1506
1058
 
1507
- case 11:
1508
- return _context2.abrupt("return", this);
1059
+ function saveEventually() {
1060
+ return _saveEventually.apply(this, arguments);
1061
+ }
1509
1062
 
1510
- case 12:
1511
- case "end":
1512
- return _context2.stop();
1513
- }
1514
- }
1515
- }, null, this, [[0, 5]], Promise);
1516
- }
1063
+ return saveEventually;
1064
+ }()
1517
1065
  }, {
1518
1066
  key: "save",
1519
1067
  value: function (arg1, arg2, arg3) {
@@ -1572,44 +1120,27 @@ var ParseObject = function () {
1572
1120
  }
1573
1121
  }, {
1574
1122
  key: "destroyEventually",
1575
- value: function (options) {
1576
- return _regeneratorRuntime().async(function (_context3) {
1577
- while (1) {
1578
- switch (_context3.prev = _context3.next) {
1579
- case 0:
1580
- _context3.prev = 0;
1581
- _context3.next = 3;
1582
- return _regeneratorRuntime().awrap(this.destroy(options));
1583
-
1584
- case 3:
1585
- _context3.next = 11;
1586
- break;
1587
-
1588
- case 5:
1589
- _context3.prev = 5;
1590
- _context3.t0 = _context3["catch"](0);
1591
-
1592
- if (!(_context3.t0.message === 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
1593
- _context3.next = 11;
1594
- break;
1595
- }
1596
-
1597
- _context3.next = 10;
1598
- return _regeneratorRuntime().awrap(_EventuallyQueue.default.destroy(this, options));
1123
+ value: function () {
1124
+ var _destroyEventually = (0, _asyncToGenerator2.default)(function* (options) {
1125
+ try {
1126
+ yield this.destroy(options);
1127
+ } catch (e) {
1128
+ if (e.message === 'XMLHttpRequest failed: "Unable to connect to the Parse API"') {
1129
+ yield _EventuallyQueue.default.destroy(this, options);
1130
+
1131
+ _EventuallyQueue.default.poll();
1132
+ }
1133
+ }
1599
1134
 
1600
- case 10:
1601
- _EventuallyQueue.default.poll();
1135
+ return this;
1136
+ });
1602
1137
 
1603
- case 11:
1604
- return _context3.abrupt("return", this);
1138
+ function destroyEventually() {
1139
+ return _destroyEventually.apply(this, arguments);
1140
+ }
1605
1141
 
1606
- case 12:
1607
- case "end":
1608
- return _context3.stop();
1609
- }
1610
- }
1611
- }, null, this, [[0, 5]], Promise);
1612
- }
1142
+ return destroyEventually;
1143
+ }()
1613
1144
  }, {
1614
1145
  key: "destroy",
1615
1146
  value: function (options) {
@@ -1647,36 +1178,24 @@ var ParseObject = function () {
1647
1178
  }, {
1648
1179
  key: "isPinned",
1649
1180
  value: function () {
1650
- var localDatastore, objectKey, pin;
1651
- return _regeneratorRuntime().async(function (_context4) {
1652
- while (1) {
1653
- switch (_context4.prev = _context4.next) {
1654
- case 0:
1655
- localDatastore = _CoreManager.default.getLocalDatastore();
1656
-
1657
- if (localDatastore.isEnabled) {
1658
- _context4.next = 3;
1659
- break;
1660
- }
1181
+ var _isPinned = (0, _asyncToGenerator2.default)(function* () {
1182
+ var localDatastore = _CoreManager.default.getLocalDatastore();
1661
1183
 
1662
- return _context4.abrupt("return", Promise.reject('Parse.enableLocalDatastore() must be called first'));
1184
+ if (!localDatastore.isEnabled) {
1185
+ return Promise.reject('Parse.enableLocalDatastore() must be called first');
1186
+ }
1663
1187
 
1664
- case 3:
1665
- objectKey = localDatastore.getKeyForObject(this);
1666
- _context4.next = 6;
1667
- return _regeneratorRuntime().awrap(localDatastore.fromPinWithName(objectKey));
1188
+ var objectKey = localDatastore.getKeyForObject(this);
1189
+ var pin = yield localDatastore.fromPinWithName(objectKey);
1190
+ return pin.length > 0;
1191
+ });
1668
1192
 
1669
- case 6:
1670
- pin = _context4.sent;
1671
- return _context4.abrupt("return", pin.length > 0);
1193
+ function isPinned() {
1194
+ return _isPinned.apply(this, arguments);
1195
+ }
1672
1196
 
1673
- case 8:
1674
- case "end":
1675
- return _context4.stop();
1676
- }
1677
- }
1678
- }, null, this, null, Promise);
1679
- }
1197
+ return isPinned;
1198
+ }()
1680
1199
  }, {
1681
1200
  key: "pinWithName",
1682
1201
  value: function (name) {
@@ -1690,49 +1209,33 @@ var ParseObject = function () {
1690
1209
  }, {
1691
1210
  key: "fetchFromLocalDatastore",
1692
1211
  value: function () {
1693
- var localDatastore, objectKey, pinned, result;
1694
- return _regeneratorRuntime().async(function (_context5) {
1695
- while (1) {
1696
- switch (_context5.prev = _context5.next) {
1697
- case 0:
1698
- localDatastore = _CoreManager.default.getLocalDatastore();
1699
-
1700
- if (localDatastore.isEnabled) {
1701
- _context5.next = 3;
1702
- break;
1703
- }
1704
-
1705
- throw new Error('Parse.enableLocalDatastore() must be called first');
1212
+ var _fetchFromLocalDatastore = (0, _asyncToGenerator2.default)(function* () {
1213
+ var localDatastore = _CoreManager.default.getLocalDatastore();
1706
1214
 
1707
- case 3:
1708
- objectKey = localDatastore.getKeyForObject(this);
1709
- _context5.next = 6;
1710
- return _regeneratorRuntime().awrap(localDatastore._serializeObject(objectKey));
1215
+ if (!localDatastore.isEnabled) {
1216
+ throw new Error('Parse.enableLocalDatastore() must be called first');
1217
+ }
1711
1218
 
1712
- case 6:
1713
- pinned = _context5.sent;
1219
+ var objectKey = localDatastore.getKeyForObject(this);
1220
+ var pinned = yield localDatastore._serializeObject(objectKey);
1714
1221
 
1715
- if (pinned) {
1716
- _context5.next = 9;
1717
- break;
1718
- }
1222
+ if (!pinned) {
1223
+ throw new Error('Cannot fetch an unsaved ParseObject');
1224
+ }
1719
1225
 
1720
- throw new Error('Cannot fetch an unsaved ParseObject');
1226
+ var result = ParseObject.fromJSON(pinned);
1721
1227
 
1722
- case 9:
1723
- result = ParseObject.fromJSON(pinned);
1228
+ this._finishFetch(result.toJSON());
1724
1229
 
1725
- this._finishFetch(result.toJSON());
1230
+ return this;
1231
+ });
1726
1232
 
1727
- return _context5.abrupt("return", this);
1233
+ function fetchFromLocalDatastore() {
1234
+ return _fetchFromLocalDatastore.apply(this, arguments);
1235
+ }
1728
1236
 
1729
- case 12:
1730
- case "end":
1731
- return _context5.stop();
1732
- }
1733
- }
1734
- }, null, this, null, Promise);
1735
- }
1237
+ return fetchFromLocalDatastore;
1238
+ }()
1736
1239
  }], [{
1737
1240
  key: "_getClassMap",
1738
1241
  value: function () {
@@ -1971,8 +1474,6 @@ var ParseObject = function () {
1971
1474
 
1972
1475
  if (this.hasOwnProperty('__super__') && this.__super__) {
1973
1476
  parentProto = this.prototype;
1974
- } else if (classMap[adjustedClassName]) {
1975
- parentProto = classMap[adjustedClassName].prototype;
1976
1477
  }
1977
1478
 
1978
1479
  var ParseObjectSubclass = function (attributes, options) {
@@ -1983,6 +1484,12 @@ var ParseObject = function () {
1983
1484
  this.initialize.apply(this, arguments);
1984
1485
  }
1985
1486
 
1487
+ if (this._initializers) {
1488
+ for (var initializer of this._initializers) {
1489
+ initializer.apply(this, arguments);
1490
+ }
1491
+ }
1492
+
1986
1493
  if (attributes && typeof attributes === 'object') {
1987
1494
  if (!this.set(attributes || {}, options)) {
1988
1495
  throw new Error("Can't create an invalid Parse Object");
@@ -1990,19 +1497,42 @@ var ParseObject = function () {
1990
1497
  }
1991
1498
  };
1992
1499
 
1993
- ParseObjectSubclass.className = adjustedClassName;
1994
- ParseObjectSubclass.__super__ = parentProto;
1995
- ParseObjectSubclass.prototype = Object.create(parentProto, {
1996
- constructor: {
1997
- value: ParseObjectSubclass,
1998
- enumerable: false,
1999
- writable: true,
2000
- configurable: true
2001
- }
2002
- });
1500
+ if (classMap[adjustedClassName]) {
1501
+ ParseObjectSubclass = classMap[adjustedClassName];
1502
+ } else {
1503
+ ParseObjectSubclass.extend = function (name, protoProps, classProps) {
1504
+ if (typeof name === 'string') {
1505
+ return ParseObject.extend.call(ParseObjectSubclass, name, protoProps, classProps);
1506
+ }
1507
+
1508
+ return ParseObject.extend.call(ParseObjectSubclass, adjustedClassName, name, protoProps);
1509
+ };
1510
+
1511
+ ParseObjectSubclass.createWithoutData = ParseObject.createWithoutData;
1512
+ ParseObjectSubclass.className = adjustedClassName;
1513
+ ParseObjectSubclass.__super__ = parentProto;
1514
+ ParseObjectSubclass.prototype = Object.create(parentProto, {
1515
+ constructor: {
1516
+ value: ParseObjectSubclass,
1517
+ enumerable: false,
1518
+ writable: true,
1519
+ configurable: true
1520
+ }
1521
+ });
1522
+ }
2003
1523
 
2004
1524
  if (protoProps) {
2005
1525
  for (var prop in protoProps) {
1526
+ if (prop === 'initialize') {
1527
+ Object.defineProperty(ParseObjectSubclass.prototype, '_initializers', {
1528
+ value: [].concat((0, _toConsumableArray2.default)(ParseObjectSubclass.prototype._initializers || []), [protoProps[prop]]),
1529
+ enumerable: false,
1530
+ writable: true,
1531
+ configurable: true
1532
+ });
1533
+ continue;
1534
+ }
1535
+
2006
1536
  if (prop !== 'className') {
2007
1537
  Object.defineProperty(ParseObjectSubclass.prototype, prop, {
2008
1538
  value: protoProps[prop],
@@ -2027,15 +1557,6 @@ var ParseObject = function () {
2027
1557
  }
2028
1558
  }
2029
1559
 
2030
- ParseObjectSubclass.extend = function (name, protoProps, classProps) {
2031
- if (typeof name === 'string') {
2032
- return ParseObject.extend.call(ParseObjectSubclass, name, protoProps, classProps);
2033
- }
2034
-
2035
- return ParseObject.extend.call(ParseObjectSubclass, adjustedClassName, name, protoProps);
2036
- };
2037
-
2038
- ParseObjectSubclass.createWithoutData = ParseObject.createWithoutData;
2039
1560
  classMap[adjustedClassName] = ParseObjectSubclass;
2040
1561
  return ParseObjectSubclass;
2041
1562
  }
@@ -2174,85 +1695,48 @@ var DefaultController = {
2174
1695
  }
2175
1696
 
2176
1697
  query._limit = ids.length;
2177
- return query.find(options).then(function (objects) {
2178
- var idMap, i, obj, _i, _obj, id, _iterator2, _step2, object;
2179
-
2180
- return _regeneratorRuntime().async(function (_context6) {
2181
- while (1) {
2182
- switch (_context6.prev = _context6.next) {
2183
- case 0:
2184
- idMap = {};
2185
- objects.forEach(function (o) {
2186
- idMap[o.id] = o;
2187
- });
2188
- i = 0;
2189
-
2190
- case 3:
2191
- if (!(i < objs.length)) {
2192
- _context6.next = 11;
2193
- break;
2194
- }
2195
-
2196
- obj = objs[i];
2197
-
2198
- if (!(!obj || !obj.id || !idMap[obj.id])) {
2199
- _context6.next = 8;
2200
- break;
2201
- }
2202
-
2203
- if (!forceFetch) {
2204
- _context6.next = 8;
2205
- break;
2206
- }
2207
-
2208
- return _context6.abrupt("return", Promise.reject(new _ParseError.default(_ParseError.default.OBJECT_NOT_FOUND, 'All objects must exist on the server.')));
2209
-
2210
- case 8:
2211
- i++;
2212
- _context6.next = 3;
2213
- break;
2214
-
2215
- case 11:
2216
- if (!singleInstance) {
2217
- for (_i = 0; _i < results.length; _i++) {
2218
- _obj = results[_i];
1698
+ return query.find(options).then(function () {
1699
+ var _ref = (0, _asyncToGenerator2.default)(function* (objects) {
1700
+ var idMap = {};
1701
+ objects.forEach(function (o) {
1702
+ idMap[o.id] = o;
1703
+ });
2219
1704
 
2220
- if (_obj && _obj.id && idMap[_obj.id]) {
2221
- id = _obj.id;
1705
+ for (var i = 0; i < objs.length; i++) {
1706
+ var obj = objs[i];
2222
1707
 
2223
- _obj._finishFetch(idMap[id].toJSON());
1708
+ if (!obj || !obj.id || !idMap[obj.id]) {
1709
+ if (forceFetch) {
1710
+ return Promise.reject(new _ParseError.default(_ParseError.default.OBJECT_NOT_FOUND, 'All objects must exist on the server.'));
1711
+ }
1712
+ }
1713
+ }
2224
1714
 
2225
- results[_i] = idMap[id];
2226
- }
2227
- }
2228
- }
1715
+ if (!singleInstance) {
1716
+ for (var _i = 0; _i < results.length; _i++) {
1717
+ var _obj = results[_i];
2229
1718
 
2230
- _iterator2 = _createForOfIteratorHelperLoose(results);
1719
+ if (_obj && _obj.id && idMap[_obj.id]) {
1720
+ var id = _obj.id;
2231
1721
 
2232
- case 13:
2233
- if ((_step2 = _iterator2()).done) {
2234
- _context6.next = 19;
2235
- break;
2236
- }
1722
+ _obj._finishFetch(idMap[id].toJSON());
2237
1723
 
2238
- object = _step2.value;
2239
- _context6.next = 17;
2240
- return _regeneratorRuntime().awrap(localDatastore._updateObjectIfPinned(object));
1724
+ results[_i] = idMap[id];
1725
+ }
1726
+ }
1727
+ }
2241
1728
 
2242
- case 17:
2243
- _context6.next = 13;
2244
- break;
1729
+ for (var object of results) {
1730
+ yield localDatastore._updateObjectIfPinned(object);
1731
+ }
2245
1732
 
2246
- case 19:
2247
- return _context6.abrupt("return", Promise.resolve(results));
1733
+ return Promise.resolve(results);
1734
+ });
2248
1735
 
2249
- case 20:
2250
- case "end":
2251
- return _context6.stop();
2252
- }
2253
- }
2254
- }, null, null, null, Promise);
2255
- });
1736
+ return function () {
1737
+ return _ref.apply(this, arguments);
1738
+ };
1739
+ }());
2256
1740
  } else if (target instanceof ParseObject) {
2257
1741
  if (!target.id) {
2258
1742
  return Promise.reject(new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'Object does not have an ID'));
@@ -2266,176 +1750,108 @@ var DefaultController = {
2266
1750
  params.include = options.include.join();
2267
1751
  }
2268
1752
 
2269
- return RESTController.request('GET', 'classes/' + target.className + '/' + target._getId(), params, options).then(function (response) {
2270
- return _regeneratorRuntime().async(function (_context7) {
2271
- while (1) {
2272
- switch (_context7.prev = _context7.next) {
2273
- case 0:
2274
- target._clearPendingOps();
2275
-
2276
- target._clearServerData();
1753
+ return RESTController.request('GET', 'classes/' + target.className + '/' + target._getId(), params, options).then(function () {
1754
+ var _ref2 = (0, _asyncToGenerator2.default)(function* (response) {
1755
+ target._clearPendingOps();
2277
1756
 
2278
- target._finishFetch(response);
1757
+ target._clearServerData();
2279
1758
 
2280
- _context7.next = 5;
2281
- return _regeneratorRuntime().awrap(localDatastore._updateObjectIfPinned(target));
1759
+ target._finishFetch(response);
2282
1760
 
2283
- case 5:
2284
- return _context7.abrupt("return", target);
1761
+ yield localDatastore._updateObjectIfPinned(target);
1762
+ return target;
1763
+ });
2285
1764
 
2286
- case 6:
2287
- case "end":
2288
- return _context7.stop();
2289
- }
2290
- }
2291
- }, null, null, null, Promise);
2292
- });
1765
+ return function () {
1766
+ return _ref2.apply(this, arguments);
1767
+ };
1768
+ }());
2293
1769
  }
2294
1770
 
2295
1771
  return Promise.resolve();
2296
1772
  },
2297
- destroy: function (target, options) {
2298
- var batchSize, localDatastore, RESTController, batches, deleteCompleted, errors;
2299
- return _regeneratorRuntime().async(function (_context10) {
2300
- while (1) {
2301
- switch (_context10.prev = _context10.next) {
2302
- case 0:
2303
- batchSize = options && options.batchSize ? options.batchSize : _CoreManager.default.get('REQUEST_BATCH_SIZE');
2304
- localDatastore = _CoreManager.default.getLocalDatastore();
2305
- RESTController = _CoreManager.default.getRESTController();
2306
-
2307
- if (!Array.isArray(target)) {
2308
- _context10.next = 15;
2309
- break;
2310
- }
1773
+ destroy: function () {
1774
+ var _destroy = (0, _asyncToGenerator2.default)(function* (target, options) {
1775
+ var batchSize = options && options.batchSize ? options.batchSize : _CoreManager.default.get('REQUEST_BATCH_SIZE');
2311
1776
 
2312
- if (!(target.length < 1)) {
2313
- _context10.next = 6;
2314
- break;
2315
- }
1777
+ var localDatastore = _CoreManager.default.getLocalDatastore();
2316
1778
 
2317
- return _context10.abrupt("return", Promise.resolve([]));
1779
+ var RESTController = _CoreManager.default.getRESTController();
2318
1780
 
2319
- case 6:
2320
- batches = [[]];
2321
- target.forEach(function (obj) {
2322
- if (!obj.id) {
2323
- return;
2324
- }
1781
+ if (Array.isArray(target)) {
1782
+ if (target.length < 1) {
1783
+ return Promise.resolve([]);
1784
+ }
2325
1785
 
2326
- batches[batches.length - 1].push(obj);
1786
+ var batches = [[]];
1787
+ target.forEach(function (obj) {
1788
+ if (!obj.id) {
1789
+ return;
1790
+ }
2327
1791
 
2328
- if (batches[batches.length - 1].length >= batchSize) {
2329
- batches.push([]);
2330
- }
2331
- });
1792
+ batches[batches.length - 1].push(obj);
2332
1793
 
2333
- if (batches[batches.length - 1].length === 0) {
2334
- batches.pop();
2335
- }
1794
+ if (batches[batches.length - 1].length >= batchSize) {
1795
+ batches.push([]);
1796
+ }
1797
+ });
2336
1798
 
2337
- deleteCompleted = Promise.resolve();
2338
- errors = [];
2339
- batches.forEach(function (batch) {
2340
- deleteCompleted = deleteCompleted.then(function () {
2341
- return RESTController.request('POST', 'batch', {
2342
- requests: batch.map(function (obj) {
2343
- return {
2344
- method: 'DELETE',
2345
- path: getServerUrlPath() + 'classes/' + obj.className + '/' + obj._getId(),
2346
- body: {}
2347
- };
2348
- })
2349
- }, options).then(function (results) {
2350
- for (var i = 0; i < results.length; i++) {
2351
- if (results[i] && results[i].hasOwnProperty('error')) {
2352
- var err = new _ParseError.default(results[i].error.code, results[i].error.error);
2353
- err.object = batch[i];
2354
- errors.push(err);
2355
- }
2356
- }
2357
- });
2358
- });
2359
- });
2360
- return _context10.abrupt("return", deleteCompleted.then(function () {
2361
- var aggregate, _iterator3, _step3, object;
2362
-
2363
- return _regeneratorRuntime().async(function (_context8) {
2364
- while (1) {
2365
- switch (_context8.prev = _context8.next) {
2366
- case 0:
2367
- if (!errors.length) {
2368
- _context8.next = 4;
2369
- break;
2370
- }
2371
-
2372
- aggregate = new _ParseError.default(_ParseError.default.AGGREGATE_ERROR);
2373
- aggregate.errors = errors;
2374
- return _context8.abrupt("return", Promise.reject(aggregate));
2375
-
2376
- case 4:
2377
- _iterator3 = _createForOfIteratorHelperLoose(target);
2378
-
2379
- case 5:
2380
- if ((_step3 = _iterator3()).done) {
2381
- _context8.next = 11;
2382
- break;
2383
- }
2384
-
2385
- object = _step3.value;
2386
- _context8.next = 9;
2387
- return _regeneratorRuntime().awrap(localDatastore._destroyObjectIfPinned(object));
2388
-
2389
- case 9:
2390
- _context8.next = 5;
2391
- break;
2392
-
2393
- case 11:
2394
- return _context8.abrupt("return", Promise.resolve(target));
2395
-
2396
- case 12:
2397
- case "end":
2398
- return _context8.stop();
2399
- }
2400
- }
2401
- }, null, null, null, Promise);
2402
- }));
1799
+ if (batches[batches.length - 1].length === 0) {
1800
+ batches.pop();
1801
+ }
2403
1802
 
2404
- case 15:
2405
- if (!(target instanceof ParseObject)) {
2406
- _context10.next = 17;
2407
- break;
2408
- }
1803
+ var deleteCompleted = Promise.resolve();
1804
+ var errors = [];
1805
+ batches.forEach(function (batch) {
1806
+ deleteCompleted = deleteCompleted.then(function () {
1807
+ return RESTController.request('POST', 'batch', {
1808
+ requests: batch.map(function (obj) {
1809
+ return {
1810
+ method: 'DELETE',
1811
+ path: getServerUrlPath() + 'classes/' + obj.className + '/' + obj._getId(),
1812
+ body: {}
1813
+ };
1814
+ })
1815
+ }, options).then(function (results) {
1816
+ for (var i = 0; i < results.length; i++) {
1817
+ if (results[i] && results[i].hasOwnProperty('error')) {
1818
+ var err = new _ParseError.default(results[i].error.code, results[i].error.error);
1819
+ err.object = batch[i];
1820
+ errors.push(err);
1821
+ }
1822
+ }
1823
+ });
1824
+ });
1825
+ });
1826
+ return deleteCompleted.then((0, _asyncToGenerator2.default)(function* () {
1827
+ if (errors.length) {
1828
+ var aggregate = new _ParseError.default(_ParseError.default.AGGREGATE_ERROR);
1829
+ aggregate.errors = errors;
1830
+ return Promise.reject(aggregate);
1831
+ }
2409
1832
 
2410
- return _context10.abrupt("return", RESTController.request('DELETE', 'classes/' + target.className + '/' + target._getId(), {}, options).then(function () {
2411
- return _regeneratorRuntime().async(function (_context9) {
2412
- while (1) {
2413
- switch (_context9.prev = _context9.next) {
2414
- case 0:
2415
- _context9.next = 2;
2416
- return _regeneratorRuntime().awrap(localDatastore._destroyObjectIfPinned(target));
1833
+ for (var object of target) {
1834
+ yield localDatastore._destroyObjectIfPinned(object);
1835
+ }
2417
1836
 
2418
- case 2:
2419
- return _context9.abrupt("return", Promise.resolve(target));
1837
+ return Promise.resolve(target);
1838
+ }));
1839
+ } else if (target instanceof ParseObject) {
1840
+ return RESTController.request('DELETE', 'classes/' + target.className + '/' + target._getId(), {}, options).then((0, _asyncToGenerator2.default)(function* () {
1841
+ yield localDatastore._destroyObjectIfPinned(target);
1842
+ return Promise.resolve(target);
1843
+ }));
1844
+ }
2420
1845
 
2421
- case 3:
2422
- case "end":
2423
- return _context9.stop();
2424
- }
2425
- }
2426
- }, null, null, null, Promise);
2427
- }));
1846
+ return Promise.resolve(target);
1847
+ });
2428
1848
 
2429
- case 17:
2430
- return _context10.abrupt("return", Promise.resolve(target));
1849
+ function destroy() {
1850
+ return _destroy.apply(this, arguments);
1851
+ }
2431
1852
 
2432
- case 18:
2433
- case "end":
2434
- return _context10.stop();
2435
- }
2436
- }
2437
- }, null, null, null, Promise);
2438
- },
1853
+ return destroy;
1854
+ }(),
2439
1855
  save: function (target, options) {
2440
1856
  var batchSize = options && options.batchSize ? options.batchSize : _CoreManager.default.get('REQUEST_BATCH_SIZE');
2441
1857
 
@@ -2544,51 +1960,18 @@ var DefaultController = {
2544
1960
  batchReturned.reject(new _ParseError.default(_ParseError.default.INCORRECT_TYPE, error.message));
2545
1961
  });
2546
1962
  return (0, _promiseUtils.when)(batchTasks);
2547
- }).then(function _callee5() {
2548
- var _iterator4, _step4, object;
2549
-
2550
- return _regeneratorRuntime().async(function _callee5$(_context11) {
2551
- while (1) {
2552
- switch (_context11.prev = _context11.next) {
2553
- case 0:
2554
- if (!objectError) {
2555
- _context11.next = 2;
2556
- break;
2557
- }
2558
-
2559
- return _context11.abrupt("return", Promise.reject(objectError));
2560
-
2561
- case 2:
2562
- _iterator4 = _createForOfIteratorHelperLoose(target);
2563
-
2564
- case 3:
2565
- if ((_step4 = _iterator4()).done) {
2566
- _context11.next = 11;
2567
- break;
2568
- }
2569
-
2570
- object = _step4.value;
2571
- _context11.next = 7;
2572
- return _regeneratorRuntime().awrap(localDatastore._updateLocalIdForObject(mapIdForPin[object.id], object));
2573
-
2574
- case 7:
2575
- _context11.next = 9;
2576
- return _regeneratorRuntime().awrap(localDatastore._updateObjectIfPinned(object));
2577
-
2578
- case 9:
2579
- _context11.next = 3;
2580
- break;
1963
+ }).then((0, _asyncToGenerator2.default)(function* () {
1964
+ if (objectError) {
1965
+ return Promise.reject(objectError);
1966
+ }
2581
1967
 
2582
- case 11:
2583
- return _context11.abrupt("return", Promise.resolve(target));
1968
+ for (var object of target) {
1969
+ yield localDatastore._updateLocalIdForObject(mapIdForPin[object.id], object);
1970
+ yield localDatastore._updateObjectIfPinned(object);
1971
+ }
2584
1972
 
2585
- case 12:
2586
- case "end":
2587
- return _context11.stop();
2588
- }
2589
- }
2590
- }, null, null, null, Promise);
2591
- });
1973
+ return Promise.resolve(target);
1974
+ }));
2592
1975
  });
2593
1976
  } else if (target instanceof ParseObject) {
2594
1977
  if (allowCustomObjectId && Object.prototype.hasOwnProperty.call(target, 'id') && !target.id) {
@@ -2616,28 +1999,11 @@ var DefaultController = {
2616
1999
  };
2617
2000
 
2618
2001
  stateController.pushPendingState(target._getStateIdentifier());
2619
- return stateController.enqueueTask(target._getStateIdentifier(), task).then(function _callee6() {
2620
- return _regeneratorRuntime().async(function _callee6$(_context12) {
2621
- while (1) {
2622
- switch (_context12.prev = _context12.next) {
2623
- case 0:
2624
- _context12.next = 2;
2625
- return _regeneratorRuntime().awrap(localDatastore._updateLocalIdForObject(localId, target));
2626
-
2627
- case 2:
2628
- _context12.next = 4;
2629
- return _regeneratorRuntime().awrap(localDatastore._updateObjectIfPinned(target));
2630
-
2631
- case 4:
2632
- return _context12.abrupt("return", target);
2633
-
2634
- case 5:
2635
- case "end":
2636
- return _context12.stop();
2637
- }
2638
- }
2639
- }, null, null, null, Promise);
2640
- }, function (error) {
2002
+ return stateController.enqueueTask(target._getStateIdentifier(), task).then((0, _asyncToGenerator2.default)(function* () {
2003
+ yield localDatastore._updateLocalIdForObject(localId, target);
2004
+ yield localDatastore._updateObjectIfPinned(target);
2005
+ return target;
2006
+ }), function (error) {
2641
2007
  return Promise.reject(error);
2642
2008
  });
2643
2009
  }