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
@@ -7,411 +7,27 @@ exports.default = void 0;
7
7
 
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
 
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+
10
12
  var _EventEmitter = _interopRequireDefault(require("./EventEmitter"));
11
13
 
12
14
  var _LiveQueryClient = _interopRequireDefault(require("./LiveQueryClient"));
13
15
 
14
16
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
15
17
 
16
- function _regeneratorRuntime() {
17
- "use strict";
18
-
19
- _regeneratorRuntime = function () {
20
- return exports;
21
- };
22
-
23
- var exports = {},
24
- Op = Object.prototype,
25
- hasOwn = Op.hasOwnProperty,
26
- $Symbol = "function" == typeof Symbol ? Symbol : {},
27
- iteratorSymbol = $Symbol.iterator || "@@iterator",
28
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
29
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
30
-
31
- function define(obj, key, value) {
32
- return Object.defineProperty(obj, key, {
33
- value: value,
34
- enumerable: !0,
35
- configurable: !0,
36
- writable: !0
37
- }), obj[key];
38
- }
39
-
40
- try {
41
- define({}, "");
42
- } catch (err) {
43
- define = function (obj, key, value) {
44
- return obj[key] = value;
45
- };
46
- }
47
-
48
- function wrap(innerFn, outerFn, self, tryLocsList) {
49
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
50
- generator = Object.create(protoGenerator.prototype),
51
- context = new Context(tryLocsList || []);
52
- return generator._invoke = function (innerFn, self, context) {
53
- var state = "suspendedStart";
54
- return function (method, arg) {
55
- if ("executing" === state) throw new Error("Generator is already running");
56
-
57
- if ("completed" === state) {
58
- if ("throw" === method) throw arg;
59
- return doneResult();
60
- }
61
-
62
- for (context.method = method, context.arg = arg;;) {
63
- var delegate = context.delegate;
64
-
65
- if (delegate) {
66
- var delegateResult = maybeInvokeDelegate(delegate, context);
67
-
68
- if (delegateResult) {
69
- if (delegateResult === ContinueSentinel) continue;
70
- return delegateResult;
71
- }
72
- }
73
-
74
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
75
- if ("suspendedStart" === state) throw state = "completed", context.arg;
76
- context.dispatchException(context.arg);
77
- } else "return" === context.method && context.abrupt("return", context.arg);
78
- state = "executing";
79
- var record = tryCatch(innerFn, self, context);
80
-
81
- if ("normal" === record.type) {
82
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
83
- return {
84
- value: record.arg,
85
- done: context.done
86
- };
87
- }
88
-
89
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
90
- }
91
- };
92
- }(innerFn, self, context), generator;
93
- }
94
-
95
- function tryCatch(fn, obj, arg) {
96
- try {
97
- return {
98
- type: "normal",
99
- arg: fn.call(obj, arg)
100
- };
101
- } catch (err) {
102
- return {
103
- type: "throw",
104
- arg: err
105
- };
106
- }
107
- }
108
-
109
- exports.wrap = wrap;
110
- var ContinueSentinel = {};
111
-
112
- function Generator() {}
113
-
114
- function GeneratorFunction() {}
115
-
116
- function GeneratorFunctionPrototype() {}
117
-
118
- var IteratorPrototype = {};
119
- define(IteratorPrototype, iteratorSymbol, function () {
120
- return this;
121
- });
122
- var getProto = Object.getPrototypeOf,
123
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
124
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
125
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
126
-
127
- function defineIteratorMethods(prototype) {
128
- ["next", "throw", "return"].forEach(function (method) {
129
- define(prototype, method, function (arg) {
130
- return this._invoke(method, arg);
131
- });
132
- });
133
- }
134
-
135
- function AsyncIterator(generator, PromiseImpl) {
136
- function invoke(method, arg, resolve, reject) {
137
- var record = tryCatch(generator[method], generator, arg);
138
-
139
- if ("throw" !== record.type) {
140
- var result = record.arg,
141
- value = result.value;
142
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
143
- invoke("next", value, resolve, reject);
144
- }, function (err) {
145
- invoke("throw", err, resolve, reject);
146
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
147
- result.value = unwrapped, resolve(result);
148
- }, function (error) {
149
- return invoke("throw", error, resolve, reject);
150
- });
151
- }
152
-
153
- reject(record.arg);
154
- }
155
-
156
- var previousPromise;
157
-
158
- this._invoke = function (method, arg) {
159
- function callInvokeWithMethodAndArg() {
160
- return new PromiseImpl(function (resolve, reject) {
161
- invoke(method, arg, resolve, reject);
162
- });
163
- }
164
-
165
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
166
- };
167
- }
168
-
169
- function maybeInvokeDelegate(delegate, context) {
170
- var method = delegate.iterator[context.method];
171
-
172
- if (undefined === method) {
173
- if (context.delegate = null, "throw" === context.method) {
174
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
175
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
176
- }
177
-
178
- return ContinueSentinel;
179
- }
180
-
181
- var record = tryCatch(method, delegate.iterator, context.arg);
182
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
183
- var info = record.arg;
184
- 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);
185
- }
186
-
187
- function pushTryEntry(locs) {
188
- var entry = {
189
- tryLoc: locs[0]
190
- };
191
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
192
- }
193
-
194
- function resetTryEntry(entry) {
195
- var record = entry.completion || {};
196
- record.type = "normal", delete record.arg, entry.completion = record;
197
- }
198
-
199
- function Context(tryLocsList) {
200
- this.tryEntries = [{
201
- tryLoc: "root"
202
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
203
- }
204
-
205
- function values(iterable) {
206
- if (iterable) {
207
- var iteratorMethod = iterable[iteratorSymbol];
208
- if (iteratorMethod) return iteratorMethod.call(iterable);
209
- if ("function" == typeof iterable.next) return iterable;
210
-
211
- if (!isNaN(iterable.length)) {
212
- var i = -1,
213
- next = function next() {
214
- for (; ++i < iterable.length;) {
215
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
216
- }
217
-
218
- return next.value = undefined, next.done = !0, next;
219
- };
220
-
221
- return next.next = next;
222
- }
223
- }
224
-
225
- return {
226
- next: doneResult
227
- };
228
- }
229
-
230
- function doneResult() {
231
- return {
232
- value: undefined,
233
- done: !0
234
- };
235
- }
236
-
237
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
238
- var ctor = "function" == typeof genFun && genFun.constructor;
239
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
240
- }, exports.mark = function (genFun) {
241
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
242
- }, exports.awrap = function (arg) {
243
- return {
244
- __await: arg
245
- };
246
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
247
- return this;
248
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
249
- void 0 === PromiseImpl && (PromiseImpl = Promise);
250
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
251
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
252
- return result.done ? result.value : iter.next();
253
- });
254
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
255
- return this;
256
- }), define(Gp, "toString", function () {
257
- return "[object Generator]";
258
- }), exports.keys = function (object) {
259
- var keys = [];
260
-
261
- for (var key in object) {
262
- keys.push(key);
263
- }
264
-
265
- return keys.reverse(), function next() {
266
- for (; keys.length;) {
267
- var key = keys.pop();
268
- if (key in object) return next.value = key, next.done = !1, next;
269
- }
270
-
271
- return next.done = !0, next;
272
- };
273
- }, exports.values = values, Context.prototype = {
274
- constructor: Context,
275
- reset: function (skipTempReset) {
276
- 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) {
277
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
278
- }
279
- },
280
- stop: function () {
281
- this.done = !0;
282
- var rootRecord = this.tryEntries[0].completion;
283
- if ("throw" === rootRecord.type) throw rootRecord.arg;
284
- return this.rval;
285
- },
286
- dispatchException: function (exception) {
287
- if (this.done) throw exception;
288
- var context = this;
289
-
290
- function handle(loc, caught) {
291
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
292
- }
293
-
294
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
295
- var entry = this.tryEntries[i],
296
- record = entry.completion;
297
- if ("root" === entry.tryLoc) return handle("end");
298
-
299
- if (entry.tryLoc <= this.prev) {
300
- var hasCatch = hasOwn.call(entry, "catchLoc"),
301
- hasFinally = hasOwn.call(entry, "finallyLoc");
302
-
303
- if (hasCatch && hasFinally) {
304
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
305
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
306
- } else if (hasCatch) {
307
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
308
- } else {
309
- if (!hasFinally) throw new Error("try statement without catch or finally");
310
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
311
- }
312
- }
313
- }
314
- },
315
- abrupt: function (type, arg) {
316
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
317
- var entry = this.tryEntries[i];
318
-
319
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
320
- var finallyEntry = entry;
321
- break;
322
- }
323
- }
324
-
325
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
326
- var record = finallyEntry ? finallyEntry.completion : {};
327
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
328
- },
329
- complete: function (record, afterLoc) {
330
- if ("throw" === record.type) throw record.arg;
331
- 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;
332
- },
333
- finish: function (finallyLoc) {
334
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
335
- var entry = this.tryEntries[i];
336
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
337
- }
338
- },
339
- catch: function (tryLoc) {
340
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
341
- var entry = this.tryEntries[i];
342
-
343
- if (entry.tryLoc === tryLoc) {
344
- var record = entry.completion;
345
-
346
- if ("throw" === record.type) {
347
- var thrown = record.arg;
348
- resetTryEntry(entry);
349
- }
350
-
351
- return thrown;
352
- }
353
- }
354
-
355
- throw new Error("illegal catch attempt");
356
- },
357
- delegateYield: function (iterable, resultName, nextLoc) {
358
- return this.delegate = {
359
- iterator: values(iterable),
360
- resultName: resultName,
361
- nextLoc: nextLoc
362
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
363
- }
364
- }, exports;
365
- }
366
-
367
18
  function getLiveQueryClient() {
368
19
  return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
369
20
  }
370
21
 
371
22
  var LiveQuery = new _EventEmitter.default();
372
-
373
- LiveQuery.open = function () {
374
- var liveQueryClient;
375
- return _regeneratorRuntime().async(function (_context) {
376
- while (1) {
377
- switch (_context.prev = _context.next) {
378
- case 0:
379
- _context.next = 2;
380
- return _regeneratorRuntime().awrap(getLiveQueryClient());
381
-
382
- case 2:
383
- liveQueryClient = _context.sent;
384
- liveQueryClient.open();
385
-
386
- case 4:
387
- case "end":
388
- return _context.stop();
389
- }
390
- }
391
- }, null, null, null, Promise);
392
- };
393
-
394
- LiveQuery.close = function () {
395
- var liveQueryClient;
396
- return _regeneratorRuntime().async(function (_context2) {
397
- while (1) {
398
- switch (_context2.prev = _context2.next) {
399
- case 0:
400
- _context2.next = 2;
401
- return _regeneratorRuntime().awrap(getLiveQueryClient());
402
-
403
- case 2:
404
- liveQueryClient = _context2.sent;
405
- liveQueryClient.close();
406
-
407
- case 4:
408
- case "end":
409
- return _context2.stop();
410
- }
411
- }
412
- }, null, null, null, Promise);
413
- };
414
-
23
+ LiveQuery.open = (0, _asyncToGenerator2.default)(function* () {
24
+ var liveQueryClient = yield getLiveQueryClient();
25
+ liveQueryClient.open();
26
+ });
27
+ LiveQuery.close = (0, _asyncToGenerator2.default)(function* () {
28
+ var liveQueryClient = yield getLiveQueryClient();
29
+ liveQueryClient.close();
30
+ });
415
31
  LiveQuery.on('error', function () {});
416
32
  var _default = LiveQuery;
417
33
  exports.default = _default;
@@ -421,77 +37,66 @@ var DefaultLiveQueryController = {
421
37
  defaultLiveQueryClient = liveQueryClient;
422
38
  },
423
39
  getDefaultLiveQueryClient: function () {
424
- var _await$Promise$all, _await$Promise$all2, currentUser, installationId, sessionToken, liveQueryServerURL, serverURL, protocol, host, applicationId, javascriptKey, masterKey;
40
+ var _getDefaultLiveQueryClient = (0, _asyncToGenerator2.default)(function* () {
41
+ if (defaultLiveQueryClient) {
42
+ return defaultLiveQueryClient;
43
+ }
425
44
 
426
- return _regeneratorRuntime().async(function (_context3) {
427
- while (1) {
428
- switch (_context3.prev = _context3.next) {
429
- case 0:
430
- if (!defaultLiveQueryClient) {
431
- _context3.next = 2;
432
- break;
433
- }
45
+ var _yield$Promise$all = yield Promise.all([_CoreManager.default.getUserController().currentUserAsync(), _CoreManager.default.getInstallationController().currentInstallationId()]),
46
+ _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 2),
47
+ currentUser = _yield$Promise$all2[0],
48
+ installationId = _yield$Promise$all2[1];
434
49
 
435
- return _context3.abrupt("return", defaultLiveQueryClient);
50
+ var sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
436
51
 
437
- case 2:
438
- _context3.next = 4;
439
- return _regeneratorRuntime().awrap(Promise.all([_CoreManager.default.getUserController().currentUserAsync(), _CoreManager.default.getInstallationController().currentInstallationId()]));
52
+ var liveQueryServerURL = _CoreManager.default.get('LIVEQUERY_SERVER_URL');
440
53
 
441
- case 4:
442
- _await$Promise$all = _context3.sent;
443
- _await$Promise$all2 = (0, _slicedToArray2.default)(_await$Promise$all, 2);
444
- currentUser = _await$Promise$all2[0];
445
- installationId = _await$Promise$all2[1];
446
- sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
447
- liveQueryServerURL = _CoreManager.default.get('LIVEQUERY_SERVER_URL');
54
+ if (liveQueryServerURL && liveQueryServerURL.indexOf('ws') !== 0) {
55
+ throw new Error('You need to set a proper Parse LiveQuery server url before using LiveQueryClient');
56
+ }
448
57
 
449
- if (!(liveQueryServerURL && liveQueryServerURL.indexOf('ws') !== 0)) {
450
- _context3.next = 12;
451
- break;
452
- }
58
+ if (!liveQueryServerURL) {
59
+ var serverURL = _CoreManager.default.get('SERVER_URL');
453
60
 
454
- throw new Error('You need to set a proper Parse LiveQuery server url before using LiveQueryClient');
61
+ var protocol = serverURL.indexOf('https') === 0 ? 'wss://' : 'ws://';
62
+ var host = serverURL.replace(/^https?:\/\//, '');
63
+ liveQueryServerURL = protocol + host;
455
64
 
456
- case 12:
457
- if (!liveQueryServerURL) {
458
- serverURL = _CoreManager.default.get('SERVER_URL');
459
- protocol = serverURL.indexOf('https') === 0 ? 'wss://' : 'ws://';
460
- host = serverURL.replace(/^https?:\/\//, '');
461
- liveQueryServerURL = protocol + host;
65
+ _CoreManager.default.set('LIVEQUERY_SERVER_URL', liveQueryServerURL);
66
+ }
462
67
 
463
- _CoreManager.default.set('LIVEQUERY_SERVER_URL', liveQueryServerURL);
464
- }
68
+ var applicationId = _CoreManager.default.get('APPLICATION_ID');
465
69
 
466
- applicationId = _CoreManager.default.get('APPLICATION_ID');
467
- javascriptKey = _CoreManager.default.get('JAVASCRIPT_KEY');
468
- masterKey = _CoreManager.default.get('MASTER_KEY');
469
- defaultLiveQueryClient = new _LiveQueryClient.default({
470
- applicationId: applicationId,
471
- serverURL: liveQueryServerURL,
472
- javascriptKey: javascriptKey,
473
- masterKey: masterKey,
474
- sessionToken: sessionToken,
475
- installationId: installationId
476
- });
477
- defaultLiveQueryClient.on('error', function (error) {
478
- LiveQuery.emit('error', error);
479
- });
480
- defaultLiveQueryClient.on('open', function () {
481
- LiveQuery.emit('open');
482
- });
483
- defaultLiveQueryClient.on('close', function () {
484
- LiveQuery.emit('close');
485
- });
486
- return _context3.abrupt("return", defaultLiveQueryClient);
70
+ var javascriptKey = _CoreManager.default.get('JAVASCRIPT_KEY');
487
71
 
488
- case 21:
489
- case "end":
490
- return _context3.stop();
491
- }
492
- }
493
- }, null, null, null, Promise);
494
- },
72
+ var masterKey = _CoreManager.default.get('MASTER_KEY');
73
+
74
+ defaultLiveQueryClient = new _LiveQueryClient.default({
75
+ applicationId: applicationId,
76
+ serverURL: liveQueryServerURL,
77
+ javascriptKey: javascriptKey,
78
+ masterKey: masterKey,
79
+ sessionToken: sessionToken,
80
+ installationId: installationId
81
+ });
82
+ defaultLiveQueryClient.on('error', function (error) {
83
+ LiveQuery.emit('error', error);
84
+ });
85
+ defaultLiveQueryClient.on('open', function () {
86
+ LiveQuery.emit('open');
87
+ });
88
+ defaultLiveQueryClient.on('close', function () {
89
+ LiveQuery.emit('close');
90
+ });
91
+ return defaultLiveQueryClient;
92
+ });
93
+
94
+ function getDefaultLiveQueryClient() {
95
+ return _getDefaultLiveQueryClient.apply(this, arguments);
96
+ }
97
+
98
+ return getDefaultLiveQueryClient;
99
+ }(),
495
100
  _clearCachedDefaultClient: function () {
496
101
  defaultLiveQueryClient = null;
497
102
  }