parse 4.0.0-alpha.1 → 4.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/LICENSE +167 -25
  2. package/NOTICE +10 -0
  3. package/README.md +6 -5
  4. package/dist/parse.js +12838 -21190
  5. package/dist/parse.min.js +7 -6
  6. package/dist/parse.weapp.js +7921 -17062
  7. package/dist/parse.weapp.min.js +7 -6
  8. package/lib/browser/Analytics.js +2 -27
  9. package/lib/browser/AnonymousUtils.js +6 -42
  10. package/lib/browser/Cloud.js +12 -77
  11. package/lib/browser/CloudCode.js +0 -3
  12. package/lib/browser/CoreManager.js +46 -191
  13. package/lib/browser/CryptoController.js +2 -16
  14. package/lib/browser/EventEmitter.js +1 -8
  15. package/lib/browser/EventuallyQueue.js +277 -824
  16. package/lib/browser/FacebookUtils.js +6 -42
  17. package/lib/browser/IndexedDBStorageController.js +3 -14
  18. package/lib/browser/InstallationController.js +2 -20
  19. package/lib/browser/LiveQueryClient.js +105 -213
  20. package/lib/browser/LiveQuerySubscription.js +10 -39
  21. package/lib/browser/LocalDatastore.js +451 -1081
  22. package/lib/browser/LocalDatastoreController.js +145 -602
  23. package/lib/browser/LocalDatastoreController.react-native.js +137 -573
  24. package/lib/browser/LocalDatastoreUtils.js +2 -19
  25. package/lib/browser/ObjectStateMutations.js +18 -121
  26. package/lib/browser/OfflineQuery.js +61 -222
  27. package/lib/browser/Parse.js +12 -115
  28. package/lib/browser/ParseACL.js +33 -148
  29. package/lib/browser/ParseCLP.js +96 -314
  30. package/lib/browser/ParseConfig.js +18 -95
  31. package/lib/browser/ParseError.js +63 -99
  32. package/lib/browser/ParseFile.js +128 -685
  33. package/lib/browser/ParseGeoPoint.js +23 -89
  34. package/lib/browser/ParseHooks.js +1 -34
  35. package/lib/browser/ParseInstallation.js +4 -32
  36. package/lib/browser/ParseLiveQuery.js +96 -505
  37. package/lib/browser/ParseObject.js +665 -1845
  38. package/lib/browser/ParseOp.js +41 -287
  39. package/lib/browser/ParsePolygon.js +13 -70
  40. package/lib/browser/ParseQuery.js +403 -1504
  41. package/lib/browser/ParseRelation.js +12 -68
  42. package/lib/browser/ParseRole.js +13 -75
  43. package/lib/browser/ParseSchema.js +49 -208
  44. package/lib/browser/ParseSession.js +11 -69
  45. package/lib/browser/ParseUser.js +274 -1127
  46. package/lib/browser/Push.js +7 -50
  47. package/lib/browser/RESTController.js +28 -157
  48. package/lib/browser/SingleInstanceStateController.js +19 -144
  49. package/lib/browser/Socket.weapp.js +0 -10
  50. package/lib/browser/Storage.js +10 -80
  51. package/lib/browser/StorageController.browser.js +4 -24
  52. package/lib/browser/StorageController.default.js +4 -24
  53. package/lib/browser/StorageController.react-native.js +6 -40
  54. package/lib/browser/StorageController.weapp.js +5 -23
  55. package/lib/browser/TaskQueue.js +1 -29
  56. package/lib/browser/UniqueInstanceStateController.js +19 -149
  57. package/lib/browser/Xhr.weapp.js +0 -17
  58. package/lib/browser/arrayContainsObject.js +2 -23
  59. package/lib/browser/canBeSerialized.js +3 -40
  60. package/lib/browser/decode.js +3 -40
  61. package/lib/browser/encode.js +9 -77
  62. package/lib/browser/equals.js +2 -34
  63. package/lib/browser/escape.js +1 -15
  64. package/lib/browser/isRevocableSession.js +2 -18
  65. package/lib/browser/parseDate.js +2 -20
  66. package/lib/browser/promiseUtils.js +3 -21
  67. package/lib/browser/unique.js +3 -24
  68. package/lib/browser/unsavedChildren.js +6 -57
  69. package/lib/browser/uuid.js +3 -1
  70. package/lib/node/Analytics.js +1 -25
  71. package/lib/node/AnonymousUtils.js +5 -44
  72. package/lib/node/Cloud.js +10 -73
  73. package/lib/node/CloudCode.js +0 -3
  74. package/lib/node/CoreManager.js +47 -227
  75. package/lib/node/CryptoController.js +2 -16
  76. package/lib/node/EventEmitter.js +1 -8
  77. package/lib/node/EventuallyQueue.js +16 -123
  78. package/lib/node/FacebookUtils.js +5 -44
  79. package/lib/node/IndexedDBStorageController.js +3 -19
  80. package/lib/node/InstallationController.js +2 -22
  81. package/lib/node/LiveQueryClient.js +72 -154
  82. package/lib/node/LiveQuerySubscription.js +7 -26
  83. package/lib/node/LocalDatastore.js +19 -182
  84. package/lib/node/LocalDatastoreController.js +6 -45
  85. package/lib/node/LocalDatastoreController.react-native.js +6 -52
  86. package/lib/node/LocalDatastoreUtils.js +1 -13
  87. package/lib/node/ObjectStateMutations.js +13 -100
  88. package/lib/node/OfflineQuery.js +27 -151
  89. package/lib/node/Parse.js +11 -108
  90. package/lib/node/ParseACL.js +32 -157
  91. package/lib/node/ParseCLP.js +69 -269
  92. package/lib/node/ParseConfig.js +16 -91
  93. package/lib/node/ParseError.js +61 -74
  94. package/lib/node/ParseFile.js +49 -212
  95. package/lib/node/ParseGeoPoint.js +21 -89
  96. package/lib/node/ParseHooks.js +0 -35
  97. package/lib/node/ParseInstallation.js +1 -17
  98. package/lib/node/ParseLiveQuery.js +10 -43
  99. package/lib/node/ParseObject.js +229 -964
  100. package/lib/node/ParseOp.js +31 -262
  101. package/lib/node/ParsePolygon.js +12 -69
  102. package/lib/node/ParseQuery.js +169 -888
  103. package/lib/node/ParseRelation.js +11 -68
  104. package/lib/node/ParseRole.js +10 -64
  105. package/lib/node/ParseSchema.js +46 -229
  106. package/lib/node/ParseSession.js +8 -57
  107. package/lib/node/ParseUser.js +107 -583
  108. package/lib/node/Push.js +4 -44
  109. package/lib/node/RESTController.js +18 -127
  110. package/lib/node/SingleInstanceStateController.js +17 -137
  111. package/lib/node/Socket.weapp.js +0 -7
  112. package/lib/node/Storage.js +10 -90
  113. package/lib/node/StorageController.browser.js +4 -30
  114. package/lib/node/StorageController.default.js +5 -28
  115. package/lib/node/StorageController.react-native.js +6 -47
  116. package/lib/node/StorageController.weapp.js +6 -28
  117. package/lib/node/TaskQueue.js +1 -24
  118. package/lib/node/UniqueInstanceStateController.js +16 -140
  119. package/lib/node/Xhr.weapp.js +0 -15
  120. package/lib/node/arrayContainsObject.js +1 -19
  121. package/lib/node/canBeSerialized.js +2 -35
  122. package/lib/node/decode.js +1 -33
  123. package/lib/node/encode.js +3 -61
  124. package/lib/node/equals.js +0 -27
  125. package/lib/node/escape.js +1 -13
  126. package/lib/node/isRevocableSession.js +1 -12
  127. package/lib/node/parseDate.js +1 -14
  128. package/lib/node/promiseUtils.js +2 -14
  129. package/lib/node/unique.js +1 -18
  130. package/lib/node/unsavedChildren.js +2 -45
  131. package/lib/node/uuid.js +6 -1
  132. package/lib/react-native/Analytics.js +0 -9
  133. package/lib/react-native/AnonymousUtils.js +0 -10
  134. package/lib/react-native/Cloud.js +0 -26
  135. package/lib/react-native/CoreManager.js +2 -6
  136. package/lib/react-native/CryptoController.js +0 -2
  137. package/lib/react-native/EventEmitter.js +0 -2
  138. package/lib/react-native/EventuallyQueue.js +156 -711
  139. package/lib/react-native/FacebookUtils.js +0 -22
  140. package/lib/react-native/IndexedDBStorageController.js +0 -1
  141. package/lib/react-native/InstallationController.js +0 -6
  142. package/lib/react-native/LiveQueryClient.js +46 -157
  143. package/lib/react-native/LiveQuerySubscription.js +3 -27
  144. package/lib/react-native/LocalDatastore.js +281 -948
  145. package/lib/react-native/LocalDatastoreController.js +71 -552
  146. package/lib/react-native/LocalDatastoreController.react-native.js +91 -526
  147. package/lib/react-native/LocalDatastoreUtils.js +0 -1
  148. package/lib/react-native/ObjectStateMutations.js +2 -65
  149. package/lib/react-native/OfflineQuery.js +25 -196
  150. package/lib/react-native/Parse.js +0 -65
  151. package/lib/react-native/ParseACL.js +0 -44
  152. package/lib/react-native/ParseCLP.js +23 -161
  153. package/lib/react-native/ParseConfig.js +0 -42
  154. package/lib/react-native/ParseError.js +1 -21
  155. package/lib/react-native/ParseFile.js +55 -529
  156. package/lib/react-native/ParseGeoPoint.js +0 -17
  157. package/lib/react-native/ParseHooks.js +0 -30
  158. package/lib/react-native/ParseInstallation.js +1 -23
  159. package/lib/react-native/ParseLiveQuery.js +55 -472
  160. package/lib/react-native/ParseObject.js +245 -1246
  161. package/lib/react-native/ParseOp.js +1 -138
  162. package/lib/react-native/ParsePolygon.js +0 -24
  163. package/lib/react-native/ParseQuery.js +182 -874
  164. package/lib/react-native/ParseRelation.js +0 -25
  165. package/lib/react-native/ParseRole.js +1 -36
  166. package/lib/react-native/ParseSchema.js +3 -54
  167. package/lib/react-native/ParseSession.js +1 -40
  168. package/lib/react-native/ParseUser.js +95 -773
  169. package/lib/react-native/Push.js +0 -16
  170. package/lib/react-native/RESTController.js +12 -109
  171. package/lib/react-native/SingleInstanceStateController.js +0 -44
  172. package/lib/react-native/Socket.weapp.js +0 -10
  173. package/lib/react-native/Storage.js +0 -24
  174. package/lib/react-native/StorageController.browser.js +0 -2
  175. package/lib/react-native/StorageController.default.js +0 -1
  176. package/lib/react-native/StorageController.react-native.js +0 -2
  177. package/lib/react-native/TaskQueue.js +0 -15
  178. package/lib/react-native/UniqueInstanceStateController.js +0 -47
  179. package/lib/react-native/Xhr.weapp.js +0 -16
  180. package/lib/react-native/arrayContainsObject.js +0 -5
  181. package/lib/react-native/canBeSerialized.js +0 -18
  182. package/lib/react-native/decode.js +0 -21
  183. package/lib/react-native/encode.js +0 -25
  184. package/lib/react-native/equals.js +0 -18
  185. package/lib/react-native/escape.js +0 -1
  186. package/lib/react-native/isRevocableSession.js +0 -1
  187. package/lib/react-native/parseDate.js +0 -3
  188. package/lib/react-native/promiseUtils.js +0 -13
  189. package/lib/react-native/unique.js +0 -4
  190. package/lib/react-native/unsavedChildren.js +0 -21
  191. package/lib/react-native/uuid.js +3 -1
  192. package/lib/weapp/Analytics.js +2 -27
  193. package/lib/weapp/AnonymousUtils.js +6 -42
  194. package/lib/weapp/Cloud.js +12 -77
  195. package/lib/weapp/CloudCode.js +0 -3
  196. package/lib/weapp/CoreManager.js +46 -191
  197. package/lib/weapp/CryptoController.js +2 -16
  198. package/lib/weapp/EventEmitter.js +1 -8
  199. package/lib/weapp/EventuallyQueue.js +277 -824
  200. package/lib/weapp/FacebookUtils.js +6 -42
  201. package/lib/weapp/IndexedDBStorageController.js +3 -14
  202. package/lib/weapp/InstallationController.js +2 -20
  203. package/lib/weapp/LiveQueryClient.js +105 -213
  204. package/lib/weapp/LiveQuerySubscription.js +10 -39
  205. package/lib/weapp/LocalDatastore.js +451 -1081
  206. package/lib/weapp/LocalDatastoreController.js +145 -602
  207. package/lib/weapp/LocalDatastoreController.react-native.js +137 -573
  208. package/lib/weapp/LocalDatastoreUtils.js +2 -19
  209. package/lib/weapp/ObjectStateMutations.js +18 -121
  210. package/lib/weapp/OfflineQuery.js +61 -222
  211. package/lib/weapp/Parse.js +12 -115
  212. package/lib/weapp/ParseACL.js +33 -148
  213. package/lib/weapp/ParseCLP.js +96 -314
  214. package/lib/weapp/ParseConfig.js +18 -95
  215. package/lib/weapp/ParseError.js +63 -99
  216. package/lib/weapp/ParseFile.js +129 -686
  217. package/lib/weapp/ParseGeoPoint.js +23 -89
  218. package/lib/weapp/ParseHooks.js +1 -34
  219. package/lib/weapp/ParseInstallation.js +4 -32
  220. package/lib/weapp/ParseLiveQuery.js +96 -505
  221. package/lib/weapp/ParseObject.js +665 -1845
  222. package/lib/weapp/ParseOp.js +41 -287
  223. package/lib/weapp/ParsePolygon.js +13 -70
  224. package/lib/weapp/ParseQuery.js +403 -1504
  225. package/lib/weapp/ParseRelation.js +12 -68
  226. package/lib/weapp/ParseRole.js +13 -75
  227. package/lib/weapp/ParseSchema.js +49 -208
  228. package/lib/weapp/ParseSession.js +11 -69
  229. package/lib/weapp/ParseUser.js +274 -1127
  230. package/lib/weapp/Push.js +7 -50
  231. package/lib/weapp/RESTController.js +28 -157
  232. package/lib/weapp/SingleInstanceStateController.js +19 -144
  233. package/lib/weapp/Socket.weapp.js +0 -10
  234. package/lib/weapp/Storage.js +10 -80
  235. package/lib/weapp/StorageController.browser.js +4 -24
  236. package/lib/weapp/StorageController.default.js +4 -24
  237. package/lib/weapp/StorageController.react-native.js +6 -40
  238. package/lib/weapp/StorageController.weapp.js +5 -23
  239. package/lib/weapp/TaskQueue.js +1 -29
  240. package/lib/weapp/UniqueInstanceStateController.js +19 -149
  241. package/lib/weapp/Xhr.weapp.js +0 -17
  242. package/lib/weapp/arrayContainsObject.js +2 -23
  243. package/lib/weapp/canBeSerialized.js +3 -40
  244. package/lib/weapp/decode.js +3 -40
  245. package/lib/weapp/encode.js +9 -77
  246. package/lib/weapp/equals.js +2 -34
  247. package/lib/weapp/escape.js +1 -15
  248. package/lib/weapp/isRevocableSession.js +2 -18
  249. package/lib/weapp/parseDate.js +2 -20
  250. package/lib/weapp/promiseUtils.js +3 -21
  251. package/lib/weapp/unique.js +3 -24
  252. package/lib/weapp/unsavedChildren.js +6 -57
  253. package/lib/weapp/uuid.js +1 -6
  254. package/package.json +34 -30
  255. package/PATENTS +0 -37
@@ -1,417 +1,25 @@
1
1
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
3
  value: true
5
4
  });
6
5
  exports.default = void 0;
7
-
8
6
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
-
7
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
8
  var _EventEmitter = _interopRequireDefault(require("./EventEmitter"));
11
-
12
9
  var _LiveQueryClient = _interopRequireDefault(require("./LiveQueryClient"));
13
-
14
10
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
15
-
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
11
  function getLiveQueryClient() {
368
12
  return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
369
13
  }
370
-
371
14
  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
-
15
+ LiveQuery.open = (0, _asyncToGenerator2.default)(function* () {
16
+ var liveQueryClient = yield getLiveQueryClient();
17
+ liveQueryClient.open();
18
+ });
19
+ LiveQuery.close = (0, _asyncToGenerator2.default)(function* () {
20
+ var liveQueryClient = yield getLiveQueryClient();
21
+ liveQueryClient.close();
22
+ });
415
23
  LiveQuery.on('error', function () {});
416
24
  var _default = LiveQuery;
417
25
  exports.default = _default;
@@ -421,80 +29,55 @@ var DefaultLiveQueryController = {
421
29
  defaultLiveQueryClient = liveQueryClient;
422
30
  },
423
31
  getDefaultLiveQueryClient: function () {
424
- var _await$Promise$all, _await$Promise$all2, currentUser, installationId, sessionToken, liveQueryServerURL, serverURL, protocol, host, applicationId, javascriptKey, masterKey;
425
-
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
- }
434
-
435
- return _context3.abrupt("return", defaultLiveQueryClient);
436
-
437
- case 2:
438
- _context3.next = 4;
439
- return _regeneratorRuntime().awrap(Promise.all([_CoreManager.default.getUserController().currentUserAsync(), _CoreManager.default.getInstallationController().currentInstallationId()]));
440
-
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');
448
-
449
- if (!(liveQueryServerURL && liveQueryServerURL.indexOf('ws') !== 0)) {
450
- _context3.next = 12;
451
- break;
452
- }
453
-
454
- throw new Error('You need to set a proper Parse LiveQuery server url before using LiveQueryClient');
455
-
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;
462
-
463
- _CoreManager.default.set('LIVEQUERY_SERVER_URL', liveQueryServerURL);
464
- }
465
-
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);
487
-
488
- case 21:
489
- case "end":
490
- return _context3.stop();
491
- }
32
+ var _getDefaultLiveQueryClient = (0, _asyncToGenerator2.default)(function* () {
33
+ if (defaultLiveQueryClient) {
34
+ return defaultLiveQueryClient;
492
35
  }
493
- }, null, null, null, Promise);
494
- },
36
+ var _yield$Promise$all = yield Promise.all([_CoreManager.default.getUserController().currentUserAsync(), _CoreManager.default.getInstallationController().currentInstallationId()]),
37
+ _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 2),
38
+ currentUser = _yield$Promise$all2[0],
39
+ installationId = _yield$Promise$all2[1];
40
+ var sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
41
+ var liveQueryServerURL = _CoreManager.default.get('LIVEQUERY_SERVER_URL');
42
+ if (liveQueryServerURL && liveQueryServerURL.indexOf('ws') !== 0) {
43
+ throw new Error('You need to set a proper Parse LiveQuery server url before using LiveQueryClient');
44
+ }
45
+ if (!liveQueryServerURL) {
46
+ var serverURL = _CoreManager.default.get('SERVER_URL');
47
+ var protocol = serverURL.indexOf('https') === 0 ? 'wss://' : 'ws://';
48
+ var host = serverURL.replace(/^https?:\/\//, '');
49
+ liveQueryServerURL = protocol + host;
50
+ _CoreManager.default.set('LIVEQUERY_SERVER_URL', liveQueryServerURL);
51
+ }
52
+ var applicationId = _CoreManager.default.get('APPLICATION_ID');
53
+ var javascriptKey = _CoreManager.default.get('JAVASCRIPT_KEY');
54
+ var masterKey = _CoreManager.default.get('MASTER_KEY');
55
+ defaultLiveQueryClient = new _LiveQueryClient.default({
56
+ applicationId: applicationId,
57
+ serverURL: liveQueryServerURL,
58
+ javascriptKey: javascriptKey,
59
+ masterKey: masterKey,
60
+ sessionToken: sessionToken,
61
+ installationId: installationId
62
+ });
63
+ defaultLiveQueryClient.on('error', function (error) {
64
+ LiveQuery.emit('error', error);
65
+ });
66
+ defaultLiveQueryClient.on('open', function () {
67
+ LiveQuery.emit('open');
68
+ });
69
+ defaultLiveQueryClient.on('close', function () {
70
+ LiveQuery.emit('close');
71
+ });
72
+ return defaultLiveQueryClient;
73
+ });
74
+ function getDefaultLiveQueryClient() {
75
+ return _getDefaultLiveQueryClient.apply(this, arguments);
76
+ }
77
+ return getDefaultLiveQueryClient;
78
+ }(),
495
79
  _clearCachedDefaultClient: function () {
496
80
  defaultLiveQueryClient = null;
497
81
  }
498
82
  };
499
-
500
83
  _CoreManager.default.setLiveQueryController(DefaultLiveQueryController);