parse 4.0.0-beta.1 → 4.0.1-beta.1

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 (154) hide show
  1. package/LICENSE +167 -25
  2. package/NOTICE +10 -0
  3. package/README.md +1 -3
  4. package/dist/parse.js +188 -374
  5. package/dist/parse.min.js +7 -6
  6. package/dist/parse.weapp.js +188 -374
  7. package/dist/parse.weapp.min.js +7 -6
  8. package/lib/browser/Analytics.js +0 -7
  9. package/lib/browser/AnonymousUtils.js +0 -7
  10. package/lib/browser/Cloud.js +0 -7
  11. package/lib/browser/CoreManager.js +1 -8
  12. package/lib/browser/EventEmitter.js +0 -7
  13. package/lib/browser/FacebookUtils.js +0 -7
  14. package/lib/browser/InstallationController.js +0 -7
  15. package/lib/browser/LocalDatastoreUtils.js +0 -7
  16. package/lib/browser/OfflineQuery.js +27 -8
  17. package/lib/browser/Parse.js +0 -9
  18. package/lib/browser/ParseACL.js +0 -7
  19. package/lib/browser/ParseConfig.js +0 -7
  20. package/lib/browser/ParseError.js +0 -9
  21. package/lib/browser/ParseGeoPoint.js +0 -7
  22. package/lib/browser/ParseObject.js +158 -126
  23. package/lib/browser/ParsePolygon.js +0 -7
  24. package/lib/browser/ParseRelation.js +0 -7
  25. package/lib/browser/ParseSchema.js +0 -7
  26. package/lib/browser/Push.js +0 -7
  27. package/lib/browser/RESTController.js +0 -7
  28. package/lib/browser/SingleInstanceStateController.js +0 -7
  29. package/lib/browser/Storage.js +0 -7
  30. package/lib/browser/StorageController.browser.js +0 -7
  31. package/lib/browser/StorageController.default.js +0 -7
  32. package/lib/browser/StorageController.react-native.js +0 -7
  33. package/lib/browser/StorageController.weapp.js +0 -7
  34. package/lib/browser/TaskQueue.js +0 -7
  35. package/lib/browser/UniqueInstanceStateController.js +0 -7
  36. package/lib/browser/arrayContainsObject.js +0 -7
  37. package/lib/browser/canBeSerialized.js +0 -7
  38. package/lib/browser/decode.js +0 -7
  39. package/lib/browser/encode.js +0 -7
  40. package/lib/browser/equals.js +0 -9
  41. package/lib/browser/escape.js +0 -7
  42. package/lib/browser/isRevocableSession.js +0 -7
  43. package/lib/browser/parseDate.js +0 -7
  44. package/lib/browser/unique.js +0 -7
  45. package/lib/browser/unsavedChildren.js +0 -7
  46. package/lib/node/Analytics.js +0 -7
  47. package/lib/node/AnonymousUtils.js +0 -7
  48. package/lib/node/Cloud.js +0 -7
  49. package/lib/node/CoreManager.js +1 -8
  50. package/lib/node/EventEmitter.js +0 -7
  51. package/lib/node/FacebookUtils.js +0 -7
  52. package/lib/node/InstallationController.js +0 -7
  53. package/lib/node/LiveQueryClient.js +0 -10
  54. package/lib/node/LiveQuerySubscription.js +0 -10
  55. package/lib/node/LocalDatastore.js +0 -7
  56. package/lib/node/LocalDatastoreController.js +0 -7
  57. package/lib/node/LocalDatastoreController.react-native.js +0 -7
  58. package/lib/node/LocalDatastoreUtils.js +0 -7
  59. package/lib/node/ObjectStateMutations.js +0 -7
  60. package/lib/node/OfflineQuery.js +8 -0
  61. package/lib/node/Parse.js +0 -9
  62. package/lib/node/ParseACL.js +0 -7
  63. package/lib/node/ParseCLP.js +0 -7
  64. package/lib/node/ParseConfig.js +0 -7
  65. package/lib/node/ParseError.js +0 -9
  66. package/lib/node/ParseFile.js +0 -7
  67. package/lib/node/ParseGeoPoint.js +0 -7
  68. package/lib/node/ParseInstallation.js +0 -7
  69. package/lib/node/ParseLiveQuery.js +0 -7
  70. package/lib/node/ParseObject.js +40 -29
  71. package/lib/node/ParseOp.js +0 -7
  72. package/lib/node/ParsePolygon.js +0 -7
  73. package/lib/node/ParseQuery.js +0 -7
  74. package/lib/node/ParseRelation.js +0 -7
  75. package/lib/node/ParseRole.js +0 -7
  76. package/lib/node/ParseSchema.js +0 -7
  77. package/lib/node/ParseSession.js +0 -7
  78. package/lib/node/ParseUser.js +0 -7
  79. package/lib/node/Push.js +0 -7
  80. package/lib/node/RESTController.js +0 -7
  81. package/lib/node/SingleInstanceStateController.js +0 -7
  82. package/lib/node/Storage.js +0 -7
  83. package/lib/node/StorageController.browser.js +0 -7
  84. package/lib/node/StorageController.default.js +0 -7
  85. package/lib/node/StorageController.react-native.js +0 -7
  86. package/lib/node/StorageController.weapp.js +0 -7
  87. package/lib/node/TaskQueue.js +0 -7
  88. package/lib/node/UniqueInstanceStateController.js +0 -7
  89. package/lib/node/arrayContainsObject.js +0 -7
  90. package/lib/node/canBeSerialized.js +0 -7
  91. package/lib/node/decode.js +0 -7
  92. package/lib/node/encode.js +0 -7
  93. package/lib/node/equals.js +0 -9
  94. package/lib/node/escape.js +0 -7
  95. package/lib/node/isRevocableSession.js +0 -7
  96. package/lib/node/parseDate.js +0 -7
  97. package/lib/node/unique.js +0 -7
  98. package/lib/node/unsavedChildren.js +0 -7
  99. package/lib/react-native/CoreManager.js +2 -2
  100. package/lib/react-native/EventuallyQueue.js +169 -676
  101. package/lib/react-native/LiveQueryClient.js +3 -46
  102. package/lib/react-native/LocalDatastore.js +303 -863
  103. package/lib/react-native/LocalDatastoreController.js +75 -535
  104. package/lib/react-native/LocalDatastoreController.react-native.js +95 -503
  105. package/lib/react-native/ObjectStateMutations.js +2 -31
  106. package/lib/react-native/OfflineQuery.js +24 -60
  107. package/lib/react-native/ParseCLP.js +55 -129
  108. package/lib/react-native/ParseFile.js +63 -468
  109. package/lib/react-native/ParseLiveQuery.js +60 -455
  110. package/lib/react-native/ParseObject.js +263 -897
  111. package/lib/react-native/ParseQuery.js +207 -643
  112. package/lib/react-native/ParseSchema.js +3 -3
  113. package/lib/react-native/ParseUser.js +118 -573
  114. package/lib/react-native/RESTController.js +1 -29
  115. package/lib/weapp/Analytics.js +0 -7
  116. package/lib/weapp/AnonymousUtils.js +0 -7
  117. package/lib/weapp/Cloud.js +0 -7
  118. package/lib/weapp/CoreManager.js +1 -8
  119. package/lib/weapp/EventEmitter.js +0 -7
  120. package/lib/weapp/FacebookUtils.js +0 -7
  121. package/lib/weapp/InstallationController.js +0 -7
  122. package/lib/weapp/LocalDatastoreUtils.js +0 -7
  123. package/lib/weapp/OfflineQuery.js +27 -8
  124. package/lib/weapp/Parse.js +0 -9
  125. package/lib/weapp/ParseACL.js +0 -7
  126. package/lib/weapp/ParseConfig.js +0 -7
  127. package/lib/weapp/ParseError.js +0 -9
  128. package/lib/weapp/ParseGeoPoint.js +0 -7
  129. package/lib/weapp/ParseObject.js +158 -126
  130. package/lib/weapp/ParsePolygon.js +0 -7
  131. package/lib/weapp/ParseRelation.js +0 -7
  132. package/lib/weapp/ParseSchema.js +0 -7
  133. package/lib/weapp/Push.js +0 -7
  134. package/lib/weapp/RESTController.js +0 -7
  135. package/lib/weapp/SingleInstanceStateController.js +0 -7
  136. package/lib/weapp/Storage.js +0 -7
  137. package/lib/weapp/StorageController.browser.js +0 -7
  138. package/lib/weapp/StorageController.default.js +0 -7
  139. package/lib/weapp/StorageController.react-native.js +0 -7
  140. package/lib/weapp/StorageController.weapp.js +0 -7
  141. package/lib/weapp/TaskQueue.js +0 -7
  142. package/lib/weapp/UniqueInstanceStateController.js +0 -7
  143. package/lib/weapp/arrayContainsObject.js +0 -7
  144. package/lib/weapp/canBeSerialized.js +0 -7
  145. package/lib/weapp/decode.js +0 -7
  146. package/lib/weapp/encode.js +0 -7
  147. package/lib/weapp/equals.js +0 -9
  148. package/lib/weapp/escape.js +0 -7
  149. package/lib/weapp/isRevocableSession.js +0 -7
  150. package/lib/weapp/parseDate.js +0 -7
  151. package/lib/weapp/unique.js +0 -7
  152. package/lib/weapp/unsavedChildren.js +0 -7
  153. package/package.json +9 -9
  154. package/PATENTS +0 -37
@@ -2,6 +2,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
2
2
 
3
3
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
4
4
 
5
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
6
+
5
7
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
6
8
 
7
9
  var _ParseObject = _interopRequireDefault(require("./ParseObject"));
@@ -10,357 +12,6 @@ var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
10
12
 
11
13
  var _Storage = _interopRequireDefault(require("./Storage"));
12
14
 
13
- function _regeneratorRuntime() {
14
- "use strict";
15
-
16
- _regeneratorRuntime = function () {
17
- return exports;
18
- };
19
-
20
- var exports = {},
21
- Op = Object.prototype,
22
- hasOwn = Op.hasOwnProperty,
23
- $Symbol = "function" == typeof Symbol ? Symbol : {},
24
- iteratorSymbol = $Symbol.iterator || "@@iterator",
25
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
26
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
27
-
28
- function define(obj, key, value) {
29
- return Object.defineProperty(obj, key, {
30
- value: value,
31
- enumerable: !0,
32
- configurable: !0,
33
- writable: !0
34
- }), obj[key];
35
- }
36
-
37
- try {
38
- define({}, "");
39
- } catch (err) {
40
- define = function (obj, key, value) {
41
- return obj[key] = value;
42
- };
43
- }
44
-
45
- function wrap(innerFn, outerFn, self, tryLocsList) {
46
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
47
- generator = Object.create(protoGenerator.prototype),
48
- context = new Context(tryLocsList || []);
49
- return generator._invoke = function (innerFn, self, context) {
50
- var state = "suspendedStart";
51
- return function (method, arg) {
52
- if ("executing" === state) throw new Error("Generator is already running");
53
-
54
- if ("completed" === state) {
55
- if ("throw" === method) throw arg;
56
- return doneResult();
57
- }
58
-
59
- for (context.method = method, context.arg = arg;;) {
60
- var delegate = context.delegate;
61
-
62
- if (delegate) {
63
- var delegateResult = maybeInvokeDelegate(delegate, context);
64
-
65
- if (delegateResult) {
66
- if (delegateResult === ContinueSentinel) continue;
67
- return delegateResult;
68
- }
69
- }
70
-
71
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
72
- if ("suspendedStart" === state) throw state = "completed", context.arg;
73
- context.dispatchException(context.arg);
74
- } else "return" === context.method && context.abrupt("return", context.arg);
75
- state = "executing";
76
- var record = tryCatch(innerFn, self, context);
77
-
78
- if ("normal" === record.type) {
79
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
80
- return {
81
- value: record.arg,
82
- done: context.done
83
- };
84
- }
85
-
86
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
87
- }
88
- };
89
- }(innerFn, self, context), generator;
90
- }
91
-
92
- function tryCatch(fn, obj, arg) {
93
- try {
94
- return {
95
- type: "normal",
96
- arg: fn.call(obj, arg)
97
- };
98
- } catch (err) {
99
- return {
100
- type: "throw",
101
- arg: err
102
- };
103
- }
104
- }
105
-
106
- exports.wrap = wrap;
107
- var ContinueSentinel = {};
108
-
109
- function Generator() {}
110
-
111
- function GeneratorFunction() {}
112
-
113
- function GeneratorFunctionPrototype() {}
114
-
115
- var IteratorPrototype = {};
116
- define(IteratorPrototype, iteratorSymbol, function () {
117
- return this;
118
- });
119
- var getProto = Object.getPrototypeOf,
120
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
121
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
122
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
123
-
124
- function defineIteratorMethods(prototype) {
125
- ["next", "throw", "return"].forEach(function (method) {
126
- define(prototype, method, function (arg) {
127
- return this._invoke(method, arg);
128
- });
129
- });
130
- }
131
-
132
- function AsyncIterator(generator, PromiseImpl) {
133
- function invoke(method, arg, resolve, reject) {
134
- var record = tryCatch(generator[method], generator, arg);
135
-
136
- if ("throw" !== record.type) {
137
- var result = record.arg,
138
- value = result.value;
139
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
140
- invoke("next", value, resolve, reject);
141
- }, function (err) {
142
- invoke("throw", err, resolve, reject);
143
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
144
- result.value = unwrapped, resolve(result);
145
- }, function (error) {
146
- return invoke("throw", error, resolve, reject);
147
- });
148
- }
149
-
150
- reject(record.arg);
151
- }
152
-
153
- var previousPromise;
154
-
155
- this._invoke = function (method, arg) {
156
- function callInvokeWithMethodAndArg() {
157
- return new PromiseImpl(function (resolve, reject) {
158
- invoke(method, arg, resolve, reject);
159
- });
160
- }
161
-
162
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
163
- };
164
- }
165
-
166
- function maybeInvokeDelegate(delegate, context) {
167
- var method = delegate.iterator[context.method];
168
-
169
- if (undefined === method) {
170
- if (context.delegate = null, "throw" === context.method) {
171
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
172
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
173
- }
174
-
175
- return ContinueSentinel;
176
- }
177
-
178
- var record = tryCatch(method, delegate.iterator, context.arg);
179
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
180
- var info = record.arg;
181
- 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);
182
- }
183
-
184
- function pushTryEntry(locs) {
185
- var entry = {
186
- tryLoc: locs[0]
187
- };
188
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
189
- }
190
-
191
- function resetTryEntry(entry) {
192
- var record = entry.completion || {};
193
- record.type = "normal", delete record.arg, entry.completion = record;
194
- }
195
-
196
- function Context(tryLocsList) {
197
- this.tryEntries = [{
198
- tryLoc: "root"
199
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
200
- }
201
-
202
- function values(iterable) {
203
- if (iterable) {
204
- var iteratorMethod = iterable[iteratorSymbol];
205
- if (iteratorMethod) return iteratorMethod.call(iterable);
206
- if ("function" == typeof iterable.next) return iterable;
207
-
208
- if (!isNaN(iterable.length)) {
209
- var i = -1,
210
- next = function next() {
211
- for (; ++i < iterable.length;) {
212
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
213
- }
214
-
215
- return next.value = undefined, next.done = !0, next;
216
- };
217
-
218
- return next.next = next;
219
- }
220
- }
221
-
222
- return {
223
- next: doneResult
224
- };
225
- }
226
-
227
- function doneResult() {
228
- return {
229
- value: undefined,
230
- done: !0
231
- };
232
- }
233
-
234
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
235
- var ctor = "function" == typeof genFun && genFun.constructor;
236
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
237
- }, exports.mark = function (genFun) {
238
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
239
- }, exports.awrap = function (arg) {
240
- return {
241
- __await: arg
242
- };
243
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
244
- return this;
245
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
246
- void 0 === PromiseImpl && (PromiseImpl = Promise);
247
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
248
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
249
- return result.done ? result.value : iter.next();
250
- });
251
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
252
- return this;
253
- }), define(Gp, "toString", function () {
254
- return "[object Generator]";
255
- }), exports.keys = function (object) {
256
- var keys = [];
257
-
258
- for (var key in object) {
259
- keys.push(key);
260
- }
261
-
262
- return keys.reverse(), function next() {
263
- for (; keys.length;) {
264
- var key = keys.pop();
265
- if (key in object) return next.value = key, next.done = !1, next;
266
- }
267
-
268
- return next.done = !0, next;
269
- };
270
- }, exports.values = values, Context.prototype = {
271
- constructor: Context,
272
- reset: function (skipTempReset) {
273
- 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) {
274
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
275
- }
276
- },
277
- stop: function () {
278
- this.done = !0;
279
- var rootRecord = this.tryEntries[0].completion;
280
- if ("throw" === rootRecord.type) throw rootRecord.arg;
281
- return this.rval;
282
- },
283
- dispatchException: function (exception) {
284
- if (this.done) throw exception;
285
- var context = this;
286
-
287
- function handle(loc, caught) {
288
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
289
- }
290
-
291
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
292
- var entry = this.tryEntries[i],
293
- record = entry.completion;
294
- if ("root" === entry.tryLoc) return handle("end");
295
-
296
- if (entry.tryLoc <= this.prev) {
297
- var hasCatch = hasOwn.call(entry, "catchLoc"),
298
- hasFinally = hasOwn.call(entry, "finallyLoc");
299
-
300
- if (hasCatch && hasFinally) {
301
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
302
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
303
- } else if (hasCatch) {
304
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
305
- } else {
306
- if (!hasFinally) throw new Error("try statement without catch or finally");
307
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
308
- }
309
- }
310
- }
311
- },
312
- abrupt: function (type, arg) {
313
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
314
- var entry = this.tryEntries[i];
315
-
316
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
317
- var finallyEntry = entry;
318
- break;
319
- }
320
- }
321
-
322
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
323
- var record = finallyEntry ? finallyEntry.completion : {};
324
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
325
- },
326
- complete: function (record, afterLoc) {
327
- if ("throw" === record.type) throw record.arg;
328
- 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;
329
- },
330
- finish: function (finallyLoc) {
331
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
332
- var entry = this.tryEntries[i];
333
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
334
- }
335
- },
336
- catch: function (tryLoc) {
337
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
338
- var entry = this.tryEntries[i];
339
-
340
- if (entry.tryLoc === tryLoc) {
341
- var record = entry.completion;
342
-
343
- if ("throw" === record.type) {
344
- var thrown = record.arg;
345
- resetTryEntry(entry);
346
- }
347
-
348
- return thrown;
349
- }
350
- }
351
-
352
- throw new Error("illegal catch attempt");
353
- },
354
- delegateYield: function (iterable, resultName, nextLoc) {
355
- return this.delegate = {
356
- iterator: values(iterable),
357
- resultName: resultName,
358
- nextLoc: nextLoc
359
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
360
- }
361
- }, exports;
362
- }
363
-
364
15
  var QUEUE_KEY = 'Parse/Eventually/Queue';
365
16
  var queueCache = [];
366
17
  var dirtyCache = true;
@@ -385,49 +36,41 @@ var EventuallyQueue = {
385
36
 
386
37
  return [action, className, id, uniqueId].join('_');
387
38
  },
388
- enqueue: function (action, object, serverOptions) {
389
- var queueData, queueId, index, prop;
390
- return _regeneratorRuntime().async(function (_context) {
391
- while (1) {
392
- switch (_context.prev = _context.next) {
393
- case 0:
394
- _context.next = 2;
395
- return _regeneratorRuntime().awrap(this.getQueue());
396
-
397
- case 2:
398
- queueData = _context.sent;
399
- queueId = this.generateQueueId(action, object);
400
- index = this.queueItemExists(queueData, queueId);
401
-
402
- if (index > -1) {
403
- for (prop in queueData[index].object) {
404
- if (typeof object.get(prop) === 'undefined') {
405
- object.set(prop, queueData[index].object[prop]);
406
- }
407
- }
408
- } else {
409
- index = queueData.length;
410
- }
411
-
412
- queueData[index] = {
413
- queueId: queueId,
414
- action: action,
415
- object: object.toJSON(),
416
- serverOptions: serverOptions,
417
- id: object.id,
418
- className: object.className,
419
- hash: object.get('hash'),
420
- createdAt: new Date()
421
- };
422
- return _context.abrupt("return", this.setQueue(queueData));
423
-
424
- case 8:
425
- case "end":
426
- return _context.stop();
39
+ enqueue: function () {
40
+ var _enqueue = (0, _asyncToGenerator2.default)(function* (action, object, serverOptions) {
41
+ var queueData = yield this.getQueue();
42
+ var queueId = this.generateQueueId(action, object);
43
+ var index = this.queueItemExists(queueData, queueId);
44
+
45
+ if (index > -1) {
46
+ for (var prop in queueData[index].object) {
47
+ if (typeof object.get(prop) === 'undefined') {
48
+ object.set(prop, queueData[index].object[prop]);
49
+ }
427
50
  }
51
+ } else {
52
+ index = queueData.length;
428
53
  }
429
- }, null, this, null, Promise);
430
- },
54
+
55
+ queueData[index] = {
56
+ queueId: queueId,
57
+ action: action,
58
+ object: object.toJSON(),
59
+ serverOptions: serverOptions,
60
+ id: object.id,
61
+ className: object.className,
62
+ hash: object.get('hash'),
63
+ createdAt: new Date()
64
+ };
65
+ return this.setQueue(queueData);
66
+ });
67
+
68
+ function enqueue() {
69
+ return _enqueue.apply(this, arguments);
70
+ }
71
+
72
+ return enqueue;
73
+ }(),
431
74
  store: function (data) {
432
75
  return _Storage.default.setItemAsync(QUEUE_KEY, JSON.stringify(data));
433
76
  },
@@ -435,77 +78,42 @@ var EventuallyQueue = {
435
78
  return _Storage.default.getItemAsync(QUEUE_KEY);
436
79
  },
437
80
  getQueue: function () {
438
- return _regeneratorRuntime().async(function (_context2) {
439
- while (1) {
440
- switch (_context2.prev = _context2.next) {
441
- case 0:
442
- if (!dirtyCache) {
443
- _context2.next = 10;
444
- break;
445
- }
446
-
447
- _context2.t0 = JSON;
448
- _context2.next = 4;
449
- return _regeneratorRuntime().awrap(this.load());
450
-
451
- case 4:
452
- _context2.t1 = _context2.sent;
453
-
454
- if (_context2.t1) {
455
- _context2.next = 7;
456
- break;
457
- }
458
-
459
- _context2.t1 = '[]';
81
+ var _getQueue = (0, _asyncToGenerator2.default)(function* () {
82
+ if (dirtyCache) {
83
+ queueCache = JSON.parse((yield this.load()) || '[]');
84
+ dirtyCache = false;
85
+ }
460
86
 
461
- case 7:
462
- _context2.t2 = _context2.t1;
463
- queueCache = _context2.t0.parse.call(_context2.t0, _context2.t2);
464
- dirtyCache = false;
87
+ return queueCache;
88
+ });
465
89
 
466
- case 10:
467
- return _context2.abrupt("return", queueCache);
90
+ function getQueue() {
91
+ return _getQueue.apply(this, arguments);
92
+ }
468
93
 
469
- case 11:
470
- case "end":
471
- return _context2.stop();
472
- }
473
- }
474
- }, null, this, null, Promise);
475
- },
94
+ return getQueue;
95
+ }(),
476
96
  setQueue: function (queue) {
477
97
  queueCache = queue;
478
98
  return this.store(queueCache);
479
99
  },
480
- remove: function (queueId) {
481
- var queueData, index;
482
- return _regeneratorRuntime().async(function (_context3) {
483
- while (1) {
484
- switch (_context3.prev = _context3.next) {
485
- case 0:
486
- _context3.next = 2;
487
- return _regeneratorRuntime().awrap(this.getQueue());
488
-
489
- case 2:
490
- queueData = _context3.sent;
491
- index = this.queueItemExists(queueData, queueId);
492
-
493
- if (!(index > -1)) {
494
- _context3.next = 8;
495
- break;
496
- }
100
+ remove: function () {
101
+ var _remove = (0, _asyncToGenerator2.default)(function* (queueId) {
102
+ var queueData = yield this.getQueue();
103
+ var index = this.queueItemExists(queueData, queueId);
104
+
105
+ if (index > -1) {
106
+ queueData.splice(index, 1);
107
+ yield this.setQueue(queueData);
108
+ }
109
+ });
497
110
 
498
- queueData.splice(index, 1);
499
- _context3.next = 8;
500
- return _regeneratorRuntime().awrap(this.setQueue(queueData));
111
+ function remove() {
112
+ return _remove.apply(this, arguments);
113
+ }
501
114
 
502
- case 8:
503
- case "end":
504
- return _context3.stop();
505
- }
506
- }
507
- }, null, this, null, Promise);
508
- },
115
+ return remove;
116
+ }(),
509
117
  clear: function () {
510
118
  queueCache = [];
511
119
  return this.store([]);
@@ -516,190 +124,95 @@ var EventuallyQueue = {
516
124
  });
517
125
  },
518
126
  length: function () {
519
- var queueData;
520
- return _regeneratorRuntime().async(function (_context4) {
521
- while (1) {
522
- switch (_context4.prev = _context4.next) {
523
- case 0:
524
- _context4.next = 2;
525
- return _regeneratorRuntime().awrap(this.getQueue());
526
-
527
- case 2:
528
- queueData = _context4.sent;
529
- return _context4.abrupt("return", queueData.length);
530
-
531
- case 4:
532
- case "end":
533
- return _context4.stop();
534
- }
535
- }
536
- }, null, this, null, Promise);
537
- },
538
- sendQueue: function () {
539
- var queue, queueData, i, queueObject, id, hash, className, ObjectType;
540
- return _regeneratorRuntime().async(function (_context5) {
541
- while (1) {
542
- switch (_context5.prev = _context5.next) {
543
- case 0:
544
- _context5.next = 2;
545
- return _regeneratorRuntime().awrap(this.getQueue());
546
-
547
- case 2:
548
- queue = _context5.sent;
549
- queueData = (0, _toConsumableArray2.default)(queue);
550
-
551
- if (!(queueData.length === 0)) {
552
- _context5.next = 6;
553
- break;
554
- }
555
-
556
- return _context5.abrupt("return", false);
557
-
558
- case 6:
559
- i = 0;
560
-
561
- case 7:
562
- if (!(i < queueData.length)) {
563
- _context5.next = 26;
564
- break;
565
- }
566
-
567
- queueObject = queueData[i];
568
- id = queueObject.id, hash = queueObject.hash, className = queueObject.className;
569
- ObjectType = _ParseObject.default.extend(className);
570
-
571
- if (!id) {
572
- _context5.next = 16;
573
- break;
574
- }
575
-
576
- _context5.next = 14;
577
- return _regeneratorRuntime().awrap(this.process.byId(ObjectType, queueObject));
578
-
579
- case 14:
580
- _context5.next = 23;
581
- break;
582
-
583
- case 16:
584
- if (!hash) {
585
- _context5.next = 21;
586
- break;
587
- }
127
+ var _length = (0, _asyncToGenerator2.default)(function* () {
128
+ var queueData = yield this.getQueue();
129
+ return queueData.length;
130
+ });
588
131
 
589
- _context5.next = 19;
590
- return _regeneratorRuntime().awrap(this.process.byHash(ObjectType, queueObject));
132
+ function length() {
133
+ return _length.apply(this, arguments);
134
+ }
591
135
 
592
- case 19:
593
- _context5.next = 23;
594
- break;
136
+ return length;
137
+ }(),
138
+ sendQueue: function () {
139
+ var _sendQueue = (0, _asyncToGenerator2.default)(function* () {
140
+ var queue = yield this.getQueue();
141
+ var queueData = (0, _toConsumableArray2.default)(queue);
595
142
 
596
- case 21:
597
- _context5.next = 23;
598
- return _regeneratorRuntime().awrap(this.process.create(ObjectType, queueObject));
143
+ if (queueData.length === 0) {
144
+ return false;
145
+ }
599
146
 
600
- case 23:
601
- i += 1;
602
- _context5.next = 7;
603
- break;
147
+ for (var i = 0; i < queueData.length; i += 1) {
148
+ var queueObject = queueData[i];
149
+ var id = queueObject.id,
150
+ hash = queueObject.hash,
151
+ className = queueObject.className;
604
152
 
605
- case 26:
606
- return _context5.abrupt("return", true);
153
+ var ObjectType = _ParseObject.default.extend(className);
607
154
 
608
- case 27:
609
- case "end":
610
- return _context5.stop();
155
+ if (id) {
156
+ yield this.process.byId(ObjectType, queueObject);
157
+ } else if (hash) {
158
+ yield this.process.byHash(ObjectType, queueObject);
159
+ } else {
160
+ yield this.process.create(ObjectType, queueObject);
611
161
  }
612
162
  }
613
- }, null, this, null, Promise);
614
- },
615
- sendQueueCallback: function (object, queueObject) {
616
- return _regeneratorRuntime().async(function (_context6) {
617
- while (1) {
618
- switch (_context6.prev = _context6.next) {
619
- case 0:
620
- if (object) {
621
- _context6.next = 2;
622
- break;
623
- }
624
-
625
- return _context6.abrupt("return", this.remove(queueObject.queueId));
626
-
627
- case 2:
628
- _context6.t0 = queueObject.action;
629
- _context6.next = _context6.t0 === 'save' ? 5 : _context6.t0 === 'destroy' ? 20 : 33;
630
- break;
631
-
632
- case 5:
633
- if (!(typeof object.updatedAt !== 'undefined' && object.updatedAt > new Date(queueObject.object.createdAt))) {
634
- _context6.next = 7;
635
- break;
636
- }
637
-
638
- return _context6.abrupt("return", this.remove(queueObject.queueId));
639
163
 
640
- case 7:
641
- _context6.prev = 7;
642
- _context6.next = 10;
643
- return _regeneratorRuntime().awrap(object.save(queueObject.object, queueObject.serverOptions));
164
+ return true;
165
+ });
644
166
 
645
- case 10:
646
- _context6.next = 12;
647
- return _regeneratorRuntime().awrap(this.remove(queueObject.queueId));
167
+ function sendQueue() {
168
+ return _sendQueue.apply(this, arguments);
169
+ }
648
170
 
649
- case 12:
650
- _context6.next = 19;
651
- break;
171
+ return sendQueue;
172
+ }(),
173
+ sendQueueCallback: function () {
174
+ var _sendQueueCallback = (0, _asyncToGenerator2.default)(function* (object, queueObject) {
175
+ if (!object) {
176
+ return this.remove(queueObject.queueId);
177
+ }
652
178
 
653
- case 14:
654
- _context6.prev = 14;
655
- _context6.t1 = _context6["catch"](7);
179
+ switch (queueObject.action) {
180
+ case 'save':
181
+ if (typeof object.updatedAt !== 'undefined' && object.updatedAt > new Date(queueObject.object.createdAt)) {
182
+ return this.remove(queueObject.queueId);
183
+ }
656
184
 
657
- if (!(_context6.t1.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
658
- _context6.next = 19;
659
- break;
185
+ try {
186
+ yield object.save(queueObject.object, queueObject.serverOptions);
187
+ yield this.remove(queueObject.queueId);
188
+ } catch (e) {
189
+ if (e.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"') {
190
+ yield this.remove(queueObject.queueId);
660
191
  }
192
+ }
661
193
 
662
- _context6.next = 19;
663
- return _regeneratorRuntime().awrap(this.remove(queueObject.queueId));
664
-
665
- case 19:
666
- return _context6.abrupt("break", 33);
667
-
668
- case 20:
669
- _context6.prev = 20;
670
- _context6.next = 23;
671
- return _regeneratorRuntime().awrap(object.destroy(queueObject.serverOptions));
672
-
673
- case 23:
674
- _context6.next = 25;
675
- return _regeneratorRuntime().awrap(this.remove(queueObject.queueId));
676
-
677
- case 25:
678
- _context6.next = 32;
679
- break;
680
-
681
- case 27:
682
- _context6.prev = 27;
683
- _context6.t2 = _context6["catch"](20);
194
+ break;
684
195
 
685
- if (!(_context6.t2.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
686
- _context6.next = 32;
687
- break;
196
+ case 'destroy':
197
+ try {
198
+ yield object.destroy(queueObject.serverOptions);
199
+ yield this.remove(queueObject.queueId);
200
+ } catch (e) {
201
+ if (e.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"') {
202
+ yield this.remove(queueObject.queueId);
688
203
  }
204
+ }
689
205
 
690
- _context6.next = 32;
691
- return _regeneratorRuntime().awrap(this.remove(queueObject.queueId));
206
+ break;
207
+ }
208
+ });
692
209
 
693
- case 32:
694
- return _context6.abrupt("break", 33);
210
+ function sendQueueCallback() {
211
+ return _sendQueueCallback.apply(this, arguments);
212
+ }
695
213
 
696
- case 33:
697
- case "end":
698
- return _context6.stop();
699
- }
700
- }
701
- }, null, this, [[7, 14], [20, 27]], Promise);
702
- },
214
+ return sendQueueCallback;
215
+ }(),
703
216
  poll: function () {
704
217
  var _this = this;
705
218
 
@@ -740,65 +253,45 @@ var EventuallyQueue = {
740
253
  var object = new ObjectType();
741
254
  return EventuallyQueue.sendQueueCallback(object, queueObject);
742
255
  },
743
- byId: function (ObjectType, queueObject) {
744
- var sessionToken, query, results;
745
- return _regeneratorRuntime().async(function (_context7) {
746
- while (1) {
747
- switch (_context7.prev = _context7.next) {
748
- case 0:
749
- sessionToken = queueObject.serverOptions.sessionToken;
750
- query = new _ParseQuery.default(ObjectType);
751
- query.equalTo('objectId', queueObject.id);
752
- _context7.next = 5;
753
- return _regeneratorRuntime().awrap(query.find({
754
- sessionToken: sessionToken
755
- }));
756
-
757
- case 5:
758
- results = _context7.sent;
759
- return _context7.abrupt("return", EventuallyQueue.sendQueueCallback(results[0], queueObject));
760
-
761
- case 7:
762
- case "end":
763
- return _context7.stop();
764
- }
765
- }
766
- }, null, null, null, Promise);
767
- },
768
- byHash: function (ObjectType, queueObject) {
769
- var sessionToken, query, results;
770
- return _regeneratorRuntime().async(function (_context8) {
771
- while (1) {
772
- switch (_context8.prev = _context8.next) {
773
- case 0:
774
- sessionToken = queueObject.serverOptions.sessionToken;
775
- query = new _ParseQuery.default(ObjectType);
776
- query.equalTo('hash', queueObject.hash);
777
- _context8.next = 5;
778
- return _regeneratorRuntime().awrap(query.find({
779
- sessionToken: sessionToken
780
- }));
781
-
782
- case 5:
783
- results = _context8.sent;
784
-
785
- if (!(results.length > 0)) {
786
- _context8.next = 8;
787
- break;
788
- }
789
-
790
- return _context8.abrupt("return", EventuallyQueue.sendQueueCallback(results[0], queueObject));
791
-
792
- case 8:
793
- return _context8.abrupt("return", EventuallyQueue.process.create(ObjectType, queueObject));
794
-
795
- case 9:
796
- case "end":
797
- return _context8.stop();
798
- }
256
+ byId: function () {
257
+ var _byId = (0, _asyncToGenerator2.default)(function* (ObjectType, queueObject) {
258
+ var sessionToken = queueObject.serverOptions.sessionToken;
259
+ var query = new _ParseQuery.default(ObjectType);
260
+ query.equalTo('objectId', queueObject.id);
261
+ var results = yield query.find({
262
+ sessionToken: sessionToken
263
+ });
264
+ return EventuallyQueue.sendQueueCallback(results[0], queueObject);
265
+ });
266
+
267
+ function byId() {
268
+ return _byId.apply(this, arguments);
269
+ }
270
+
271
+ return byId;
272
+ }(),
273
+ byHash: function () {
274
+ var _byHash = (0, _asyncToGenerator2.default)(function* (ObjectType, queueObject) {
275
+ var sessionToken = queueObject.serverOptions.sessionToken;
276
+ var query = new _ParseQuery.default(ObjectType);
277
+ query.equalTo('hash', queueObject.hash);
278
+ var results = yield query.find({
279
+ sessionToken: sessionToken
280
+ });
281
+
282
+ if (results.length > 0) {
283
+ return EventuallyQueue.sendQueueCallback(results[0], queueObject);
799
284
  }
800
- }, null, null, null, Promise);
801
- }
285
+
286
+ return EventuallyQueue.process.create(ObjectType, queueObject);
287
+ });
288
+
289
+ function byHash() {
290
+ return _byHash.apply(this, arguments);
291
+ }
292
+
293
+ return byHash;
294
+ }()
802
295
  }
803
296
  };
804
297
  module.exports = EventuallyQueue;