parse 4.0.0-alpha.1 → 4.0.0-alpha.11

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 +35 -31
  255. package/PATENTS +0 -37
@@ -1,411 +1,29 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
6
-
7
- var _reverseInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/reverse");
8
-
9
- var _Promise = require("@babel/runtime-corejs3/core-js-stable/promise");
10
-
11
- var _Object$setPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
12
-
13
- var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
14
-
15
- var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
16
-
17
- var _Object$getPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
18
-
19
- var _Object$create = require("@babel/runtime-corejs3/core-js-stable/object/create");
20
-
21
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
22
-
23
- var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
24
-
25
- var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
26
-
4
+ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
5
+ var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/splice"));
6
+ var _findIndex = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
27
7
  var _setInterval2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-interval"));
28
-
8
+ var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
9
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
29
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/toConsumableArray"));
30
-
31
- var _findIndex = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
32
-
33
- var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/splice"));
34
-
35
- var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
36
-
37
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
38
-
39
12
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
40
-
41
13
  var _ParseObject = _interopRequireDefault(require("./ParseObject"));
42
-
43
14
  var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
44
-
45
15
  var _Storage = _interopRequireDefault(require("./Storage"));
46
-
47
- function _regeneratorRuntime() {
48
- "use strict";
49
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
50
-
51
- _regeneratorRuntime = function () {
52
- return exports;
53
- };
54
-
55
- var exports = {},
56
- Op = Object.prototype,
57
- hasOwn = Op.hasOwnProperty,
58
- $Symbol = "function" == typeof _Symbol ? _Symbol : {},
59
- iteratorSymbol = $Symbol.iterator || "@@iterator",
60
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
61
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
62
-
63
- function define(obj, key, value) {
64
- return _Object$defineProperty(obj, key, {
65
- value: value,
66
- enumerable: !0,
67
- configurable: !0,
68
- writable: !0
69
- }), obj[key];
70
- }
71
-
72
- try {
73
- define({}, "");
74
- } catch (err) {
75
- define = function (obj, key, value) {
76
- return obj[key] = value;
77
- };
78
- }
79
-
80
- function wrap(innerFn, outerFn, self, tryLocsList) {
81
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
82
- generator = _Object$create(protoGenerator.prototype),
83
- context = new Context(tryLocsList || []);
84
-
85
- return generator._invoke = function (innerFn, self, context) {
86
- var state = "suspendedStart";
87
- return function (method, arg) {
88
- if ("executing" === state) throw new Error("Generator is already running");
89
-
90
- if ("completed" === state) {
91
- if ("throw" === method) throw arg;
92
- return doneResult();
93
- }
94
-
95
- for (context.method = method, context.arg = arg;;) {
96
- var delegate = context.delegate;
97
-
98
- if (delegate) {
99
- var delegateResult = maybeInvokeDelegate(delegate, context);
100
-
101
- if (delegateResult) {
102
- if (delegateResult === ContinueSentinel) continue;
103
- return delegateResult;
104
- }
105
- }
106
-
107
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
108
- if ("suspendedStart" === state) throw state = "completed", context.arg;
109
- context.dispatchException(context.arg);
110
- } else "return" === context.method && context.abrupt("return", context.arg);
111
- state = "executing";
112
- var record = tryCatch(innerFn, self, context);
113
-
114
- if ("normal" === record.type) {
115
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
116
- return {
117
- value: record.arg,
118
- done: context.done
119
- };
120
- }
121
-
122
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
123
- }
124
- };
125
- }(innerFn, self, context), generator;
126
- }
127
-
128
- function tryCatch(fn, obj, arg) {
129
- try {
130
- return {
131
- type: "normal",
132
- arg: fn.call(obj, arg)
133
- };
134
- } catch (err) {
135
- return {
136
- type: "throw",
137
- arg: err
138
- };
139
- }
140
- }
141
-
142
- exports.wrap = wrap;
143
- var ContinueSentinel = {};
144
-
145
- function Generator() {}
146
-
147
- function GeneratorFunction() {}
148
-
149
- function GeneratorFunctionPrototype() {}
150
-
151
- var IteratorPrototype = {};
152
- define(IteratorPrototype, iteratorSymbol, function () {
153
- return this;
154
- });
155
- var getProto = _Object$getPrototypeOf,
156
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
157
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
158
-
159
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
160
-
161
- function defineIteratorMethods(prototype) {
162
- var _context9;
163
-
164
- _forEachInstanceProperty(_context9 = ["next", "throw", "return"]).call(_context9, function (method) {
165
- define(prototype, method, function (arg) {
166
- return this._invoke(method, arg);
167
- });
168
- });
169
- }
170
-
171
- function AsyncIterator(generator, PromiseImpl) {
172
- function invoke(method, arg, resolve, reject) {
173
- var record = tryCatch(generator[method], generator, arg);
174
-
175
- if ("throw" !== record.type) {
176
- var result = record.arg,
177
- value = result.value;
178
- return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
179
- invoke("next", value, resolve, reject);
180
- }, function (err) {
181
- invoke("throw", err, resolve, reject);
182
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
183
- result.value = unwrapped, resolve(result);
184
- }, function (error) {
185
- return invoke("throw", error, resolve, reject);
186
- });
187
- }
188
-
189
- reject(record.arg);
190
- }
191
-
192
- var previousPromise;
193
-
194
- this._invoke = function (method, arg) {
195
- function callInvokeWithMethodAndArg() {
196
- return new PromiseImpl(function (resolve, reject) {
197
- invoke(method, arg, resolve, reject);
198
- });
199
- }
200
-
201
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
202
- };
203
- }
204
-
205
- function maybeInvokeDelegate(delegate, context) {
206
- var method = delegate.iterator[context.method];
207
-
208
- if (undefined === method) {
209
- if (context.delegate = null, "throw" === context.method) {
210
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
211
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
212
- }
213
-
214
- return ContinueSentinel;
215
- }
216
-
217
- var record = tryCatch(method, delegate.iterator, context.arg);
218
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
219
- var info = record.arg;
220
- 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);
221
- }
222
-
223
- function pushTryEntry(locs) {
224
- var entry = {
225
- tryLoc: locs[0]
226
- };
227
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
228
- }
229
-
230
- function resetTryEntry(entry) {
231
- var record = entry.completion || {};
232
- record.type = "normal", delete record.arg, entry.completion = record;
233
- }
234
-
235
- function Context(tryLocsList) {
236
- this.tryEntries = [{
237
- tryLoc: "root"
238
- }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
239
- }
240
-
241
- function values(iterable) {
242
- if (iterable) {
243
- var iteratorMethod = iterable[iteratorSymbol];
244
- if (iteratorMethod) return iteratorMethod.call(iterable);
245
- if ("function" == typeof iterable.next) return iterable;
246
-
247
- if (!isNaN(iterable.length)) {
248
- var i = -1,
249
- next = function next() {
250
- for (; ++i < iterable.length;) {
251
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
252
- }
253
-
254
- return next.value = undefined, next.done = !0, next;
255
- };
256
-
257
- return next.next = next;
258
- }
259
- }
260
-
261
- return {
262
- next: doneResult
263
- };
264
- }
265
-
266
- function doneResult() {
267
- return {
268
- value: undefined,
269
- done: !0
270
- };
271
- }
272
-
273
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
274
- var ctor = "function" == typeof genFun && genFun.constructor;
275
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
276
- }, exports.mark = function (genFun) {
277
- return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
278
- }, exports.awrap = function (arg) {
279
- return {
280
- __await: arg
281
- };
282
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
283
- return this;
284
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
285
- void 0 === PromiseImpl && (PromiseImpl = _Promise);
286
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
287
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
288
- return result.done ? result.value : iter.next();
289
- });
290
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
291
- return this;
292
- }), define(Gp, "toString", function () {
293
- return "[object Generator]";
294
- }), exports.keys = function (object) {
295
- var keys = [];
296
-
297
- for (var key in object) {
298
- keys.push(key);
299
- }
300
-
301
- return _reverseInstanceProperty(keys).call(keys), function next() {
302
- for (; keys.length;) {
303
- var key = keys.pop();
304
- if (key in object) return next.value = key, next.done = !1, next;
305
- }
306
-
307
- return next.done = !0, next;
308
- };
309
- }, exports.values = values, Context.prototype = {
310
- constructor: Context,
311
- reset: function (skipTempReset) {
312
- var _context10;
313
-
314
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context10 = this.tryEntries).call(_context10, resetTryEntry), !skipTempReset) for (var name in this) {
315
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
316
- }
317
- },
318
- stop: function () {
319
- this.done = !0;
320
- var rootRecord = this.tryEntries[0].completion;
321
- if ("throw" === rootRecord.type) throw rootRecord.arg;
322
- return this.rval;
323
- },
324
- dispatchException: function (exception) {
325
- if (this.done) throw exception;
326
- var context = this;
327
-
328
- function handle(loc, caught) {
329
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
330
- }
331
-
332
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
333
- var entry = this.tryEntries[i],
334
- record = entry.completion;
335
- if ("root" === entry.tryLoc) return handle("end");
336
-
337
- if (entry.tryLoc <= this.prev) {
338
- var hasCatch = hasOwn.call(entry, "catchLoc"),
339
- hasFinally = hasOwn.call(entry, "finallyLoc");
340
-
341
- if (hasCatch && hasFinally) {
342
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
343
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
344
- } else if (hasCatch) {
345
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
346
- } else {
347
- if (!hasFinally) throw new Error("try statement without catch or finally");
348
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
349
- }
350
- }
351
- }
352
- },
353
- abrupt: function (type, arg) {
354
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
355
- var entry = this.tryEntries[i];
356
-
357
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
358
- var finallyEntry = entry;
359
- break;
360
- }
361
- }
362
-
363
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
364
- var record = finallyEntry ? finallyEntry.completion : {};
365
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
366
- },
367
- complete: function (record, afterLoc) {
368
- if ("throw" === record.type) throw record.arg;
369
- 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;
370
- },
371
- finish: function (finallyLoc) {
372
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
373
- var entry = this.tryEntries[i];
374
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
375
- }
376
- },
377
- catch: function (tryLoc) {
378
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
379
- var entry = this.tryEntries[i];
380
-
381
- if (entry.tryLoc === tryLoc) {
382
- var record = entry.completion;
383
-
384
- if ("throw" === record.type) {
385
- var thrown = record.arg;
386
- resetTryEntry(entry);
387
- }
388
-
389
- return thrown;
390
- }
391
- }
392
-
393
- throw new Error("illegal catch attempt");
394
- },
395
- delegateYield: function (iterable, resultName, nextLoc) {
396
- return this.delegate = {
397
- iterator: values(iterable),
398
- resultName: resultName,
399
- nextLoc: nextLoc
400
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
401
- }
402
- }, exports;
403
- }
16
+ /**
17
+ * https://github.com/francimedia/parse-js-local-storage
18
+ *
19
+ * @flow
20
+ */
404
21
 
405
22
  var QUEUE_KEY = 'Parse/Eventually/Queue';
406
23
  var queueCache = [];
407
24
  var dirtyCache = true;
408
25
  var polling = undefined;
26
+
409
27
  /**
410
28
  * Provides utility functions to queue objects that will be
411
29
  * saved to the server at a later date.
@@ -413,7 +31,6 @@ var polling = undefined;
413
31
  * @class Parse.EventuallyQueue
414
32
  * @static
415
33
  */
416
-
417
34
  var EventuallyQueue = {
418
35
  /**
419
36
  * Add object to queue with save operation.
@@ -426,17 +43,10 @@ var EventuallyQueue = {
426
43
  * @static
427
44
  * @see Parse.Object#saveEventually
428
45
  */
429
- save: function (object
430
- /*: ParseObject*/
431
- )
432
- /*: Promise*/
433
- {
434
- var serverOptions
435
- /*: SaveOptions*/
436
- = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
46
+ save: function (object /*: ParseObject*/) /*: Promise*/{
47
+ var serverOptions /*: SaveOptions*/ = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
437
48
  return this.enqueue('save', object, serverOptions);
438
49
  },
439
-
440
50
  /**
441
51
  * Add object to queue with save operation.
442
52
  *
@@ -448,17 +58,10 @@ var EventuallyQueue = {
448
58
  * @static
449
59
  * @see Parse.Object#destroyEventually
450
60
  */
451
- destroy: function (object
452
- /*: ParseObject*/
453
- )
454
- /*: Promise*/
455
- {
456
- var serverOptions
457
- /*: RequestOptions*/
458
- = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
61
+ destroy: function (object /*: ParseObject*/) /*: Promise*/{
62
+ var serverOptions /*: RequestOptions*/ = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
459
63
  return this.enqueue('destroy', object, serverOptions);
460
64
  },
461
-
462
65
  /**
463
66
  * Generate unique identifier to avoid duplicates and maintain previous state.
464
67
  *
@@ -468,24 +71,14 @@ var EventuallyQueue = {
468
71
  * @static
469
72
  * @ignore
470
73
  */
471
- generateQueueId: function (action
472
- /*: string*/
473
- , object
474
- /*: ParseObject*/
475
- )
476
- /*: string*/
477
- {
74
+ generateQueueId: function (action /*: string*/, object /*: ParseObject*/) /*: string*/{
478
75
  object._getId();
479
-
480
76
  var className = object.className,
481
- id = object.id,
482
- _localId = object._localId;
483
-
77
+ id = object.id,
78
+ _localId = object._localId;
484
79
  var uniqueId = object.get('hash') || _localId;
485
-
486
80
  return [action, className, id, uniqueId].join('_');
487
81
  },
488
-
489
82
  /**
490
83
  * Build queue object and add to queue.
491
84
  *
@@ -496,69 +89,53 @@ var EventuallyQueue = {
496
89
  * @static
497
90
  * @ignore
498
91
  */
499
- enqueue: function (action
500
- /*: string*/
501
- , object
502
- /*: ParseObject*/
503
- , serverOptions
504
- /*: SaveOptions | RequestOptions*/
505
- )
506
- /*: Promise*/
507
- {
92
+ enqueue: function (action /*: string*/, object /*: ParseObject*/, serverOptions /*: SaveOptions | RequestOptions*/) /*: Promise*/{
508
93
  var _this = this;
509
-
510
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
94
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
511
95
  var queueData, queueId, index, prop;
512
- return _regeneratorRuntime().wrap(function _callee$(_context) {
513
- while (1) {
514
- switch (_context.prev = _context.next) {
515
- case 0:
516
- _context.next = 2;
517
- return _this.getQueue();
518
-
519
- case 2:
520
- queueData = _context.sent;
521
- queueId = _this.generateQueueId(action, object);
522
- index = _this.queueItemExists(queueData, queueId);
523
-
524
- if (index > -1) {
525
- // Add cached values to new object if they don't exist
526
- for (prop in queueData[index].object) {
527
- if (typeof object.get(prop) === 'undefined') {
528
- object.set(prop, queueData[index].object[prop]);
529
- }
96
+ return _regenerator.default.wrap(function (_context) {
97
+ while (1) switch (_context.prev = _context.next) {
98
+ case 0:
99
+ _context.next = 2;
100
+ return _this.getQueue();
101
+ case 2:
102
+ queueData = _context.sent;
103
+ queueId = _this.generateQueueId(action, object);
104
+ index = _this.queueItemExists(queueData, queueId);
105
+ if (index > -1) {
106
+ // Add cached values to new object if they don't exist
107
+ for (prop in queueData[index].object) {
108
+ if (typeof object.get(prop) === 'undefined') {
109
+ object.set(prop, queueData[index].object[prop]);
530
110
  }
531
- } else {
532
- index = queueData.length;
533
111
  }
534
-
535
- queueData[index] = {
536
- queueId: queueId,
537
- action: action,
538
- object: object.toJSON(),
539
- serverOptions: serverOptions,
540
- id: object.id,
541
- className: object.className,
542
- hash: object.get('hash'),
543
- createdAt: new Date()
544
- };
545
- return _context.abrupt("return", _this.setQueue(queueData));
546
-
547
- case 8:
548
- case "end":
549
- return _context.stop();
550
- }
112
+ } else {
113
+ index = queueData.length;
114
+ }
115
+ queueData[index] = {
116
+ queueId: queueId,
117
+ action: action,
118
+ object: object.toJSON(),
119
+ serverOptions: serverOptions,
120
+ id: object.id,
121
+ className: object.className,
122
+ hash: object.get('hash'),
123
+ createdAt: new Date()
124
+ };
125
+ return _context.abrupt("return", _this.setQueue(queueData));
126
+ case 8:
127
+ case "end":
128
+ return _context.stop();
551
129
  }
552
130
  }, _callee);
553
131
  }))();
554
132
  },
555
- store: function store(data) {
133
+ store: function (data) {
556
134
  return _Storage.default.setItemAsync(QUEUE_KEY, (0, _stringify.default)(data));
557
135
  },
558
- load: function load() {
136
+ load: function () {
559
137
  return _Storage.default.getItemAsync(QUEUE_KEY);
560
138
  },
561
-
562
139
  /**
563
140
  * Sets the in-memory queue from local storage and returns.
564
141
  *
@@ -567,52 +144,39 @@ var EventuallyQueue = {
567
144
  * @returns {Promise<Array>}
568
145
  * @static
569
146
  */
570
- getQueue: function getQueue()
571
- /*: Promise<Array>*/
572
- {
147
+ getQueue: function () /*: Promise<Array>*/{
573
148
  var _this2 = this;
574
-
575
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
576
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
577
- while (1) {
578
- switch (_context2.prev = _context2.next) {
579
- case 0:
580
- if (!dirtyCache) {
581
- _context2.next = 10;
582
- break;
583
- }
584
-
585
- _context2.t0 = JSON;
586
- _context2.next = 4;
587
- return _this2.load();
588
-
589
- case 4:
590
- _context2.t1 = _context2.sent;
591
-
592
- if (_context2.t1) {
593
- _context2.next = 7;
594
- break;
595
- }
596
-
597
- _context2.t1 = '[]';
598
-
599
- case 7:
600
- _context2.t2 = _context2.t1;
601
- queueCache = _context2.t0.parse.call(_context2.t0, _context2.t2);
602
- dirtyCache = false;
603
-
604
- case 10:
605
- return _context2.abrupt("return", queueCache);
606
-
607
- case 11:
608
- case "end":
609
- return _context2.stop();
610
- }
149
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
150
+ return _regenerator.default.wrap(function (_context2) {
151
+ while (1) switch (_context2.prev = _context2.next) {
152
+ case 0:
153
+ if (!dirtyCache) {
154
+ _context2.next = 10;
155
+ break;
156
+ }
157
+ _context2.t0 = JSON;
158
+ _context2.next = 4;
159
+ return _this2.load();
160
+ case 4:
161
+ _context2.t1 = _context2.sent;
162
+ if (_context2.t1) {
163
+ _context2.next = 7;
164
+ break;
165
+ }
166
+ _context2.t1 = '[]';
167
+ case 7:
168
+ _context2.t2 = _context2.t1;
169
+ queueCache = _context2.t0.parse.call(_context2.t0, _context2.t2);
170
+ dirtyCache = false;
171
+ case 10:
172
+ return _context2.abrupt("return", queueCache);
173
+ case 11:
174
+ case "end":
175
+ return _context2.stop();
611
176
  }
612
177
  }, _callee2);
613
178
  }))();
614
179
  },
615
-
616
180
  /**
617
181
  * Saves the queue to local storage
618
182
  *
@@ -621,15 +185,10 @@ var EventuallyQueue = {
621
185
  * @static
622
186
  * @ignore
623
187
  */
624
- setQueue: function setQueue(queue
625
- /*: Queue*/
626
- )
627
- /*: Promise<void>*/
628
- {
188
+ setQueue: function (queue /*: Queue*/) /*: Promise<void>*/{
629
189
  queueCache = queue;
630
190
  return this.store(queueCache);
631
191
  },
632
-
633
192
  /**
634
193
  * Removes Parse.Object data from queue.
635
194
  *
@@ -638,44 +197,32 @@ var EventuallyQueue = {
638
197
  * @static
639
198
  * @ignore
640
199
  */
641
- remove: function remove(queueId
642
- /*: string*/
643
- )
644
- /*: Promise<void>*/
645
- {
200
+ remove: function (queueId /*: string*/) /*: Promise<void>*/{
646
201
  var _this3 = this;
647
-
648
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
202
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
649
203
  var queueData, index;
650
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
651
- while (1) {
652
- switch (_context3.prev = _context3.next) {
653
- case 0:
654
- _context3.next = 2;
655
- return _this3.getQueue();
656
-
657
- case 2:
658
- queueData = _context3.sent;
659
- index = _this3.queueItemExists(queueData, queueId);
660
-
661
- if (!(index > -1)) {
662
- _context3.next = 8;
663
- break;
664
- }
665
-
666
- (0, _splice.default)(queueData).call(queueData, index, 1);
204
+ return _regenerator.default.wrap(function (_context3) {
205
+ while (1) switch (_context3.prev = _context3.next) {
206
+ case 0:
207
+ _context3.next = 2;
208
+ return _this3.getQueue();
209
+ case 2:
210
+ queueData = _context3.sent;
211
+ index = _this3.queueItemExists(queueData, queueId);
212
+ if (!(index > -1)) {
667
213
  _context3.next = 8;
668
- return _this3.setQueue(queueData);
669
-
670
- case 8:
671
- case "end":
672
- return _context3.stop();
673
- }
214
+ break;
215
+ }
216
+ (0, _splice.default)(queueData).call(queueData, index, 1);
217
+ _context3.next = 8;
218
+ return _this3.setQueue(queueData);
219
+ case 8:
220
+ case "end":
221
+ return _context3.stop();
674
222
  }
675
223
  }, _callee3);
676
224
  }))();
677
225
  },
678
-
679
226
  /**
680
227
  * Removes all objects from queue.
681
228
  *
@@ -684,13 +231,10 @@ var EventuallyQueue = {
684
231
  * @returns {Promise} A promise that is fulfilled when queue is cleared.
685
232
  * @static
686
233
  */
687
- clear: function clear()
688
- /*: Promise*/
689
- {
234
+ clear: function () /*: Promise*/{
690
235
  queueCache = [];
691
236
  return this.store([]);
692
237
  },
693
-
694
238
  /**
695
239
  * Return the index of a queueId in the queue. Returns -1 if not found.
696
240
  *
@@ -700,18 +244,11 @@ var EventuallyQueue = {
700
244
  * @static
701
245
  * @ignore
702
246
  */
703
- queueItemExists: function queueItemExists(queue
704
- /*: Queue*/
705
- , queueId
706
- /*: string*/
707
- )
708
- /*: number*/
709
- {
247
+ queueItemExists: function (queue /*: Queue*/, queueId /*: string*/) /*: number*/{
710
248
  return (0, _findIndex.default)(queue).call(queue, function (data) {
711
249
  return data.queueId === queueId;
712
250
  });
713
251
  },
714
-
715
252
  /**
716
253
  * Return the number of objects in the queue.
717
254
  *
@@ -720,33 +257,25 @@ var EventuallyQueue = {
720
257
  * @returns {number}
721
258
  * @static
722
259
  */
723
- length: function length()
724
- /*: number*/
725
- {
260
+ length: function () /*: number*/{
726
261
  var _this4 = this;
727
-
728
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
262
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
729
263
  var queueData;
730
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
731
- while (1) {
732
- switch (_context4.prev = _context4.next) {
733
- case 0:
734
- _context4.next = 2;
735
- return _this4.getQueue();
736
-
737
- case 2:
738
- queueData = _context4.sent;
739
- return _context4.abrupt("return", queueData.length);
740
-
741
- case 4:
742
- case "end":
743
- return _context4.stop();
744
- }
264
+ return _regenerator.default.wrap(function (_context4) {
265
+ while (1) switch (_context4.prev = _context4.next) {
266
+ case 0:
267
+ _context4.next = 2;
268
+ return _this4.getQueue();
269
+ case 2:
270
+ queueData = _context4.sent;
271
+ return _context4.abrupt("return", queueData.length);
272
+ case 4:
273
+ case "end":
274
+ return _context4.stop();
745
275
  }
746
276
  }, _callee4);
747
277
  }))();
748
278
  },
749
-
750
279
  /**
751
280
  * Sends the queue to the server.
752
281
  *
@@ -755,90 +284,68 @@ var EventuallyQueue = {
755
284
  * @returns {Promise<boolean>} Returns true if queue was sent successfully.
756
285
  * @static
757
286
  */
758
- sendQueue: function sendQueue()
759
- /*: Promise<boolean>*/
760
- {
287
+ sendQueue: function () /*: Promise<boolean>*/{
761
288
  var _this5 = this;
762
-
763
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
289
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
764
290
  var queue, queueData, i, queueObject, id, hash, className, ObjectType;
765
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
766
- while (1) {
767
- switch (_context5.prev = _context5.next) {
768
- case 0:
769
- _context5.next = 2;
770
- return _this5.getQueue();
771
-
772
- case 2:
773
- queue = _context5.sent;
774
- queueData = (0, _toConsumableArray2.default)(queue);
775
-
776
- if (!(queueData.length === 0)) {
777
- _context5.next = 6;
778
- break;
779
- }
780
-
781
- return _context5.abrupt("return", false);
782
-
783
- case 6:
784
- i = 0;
785
-
786
- case 7:
787
- if (!(i < queueData.length)) {
788
- _context5.next = 26;
789
- break;
790
- }
791
-
792
- queueObject = queueData[i];
793
- id = queueObject.id, hash = queueObject.hash, className = queueObject.className;
794
- ObjectType = _ParseObject.default.extend(className);
795
-
796
- if (!id) {
797
- _context5.next = 16;
798
- break;
799
- }
800
-
801
- _context5.next = 14;
802
- return _this5.process.byId(ObjectType, queueObject);
803
-
804
- case 14:
805
- _context5.next = 23;
291
+ return _regenerator.default.wrap(function (_context5) {
292
+ while (1) switch (_context5.prev = _context5.next) {
293
+ case 0:
294
+ _context5.next = 2;
295
+ return _this5.getQueue();
296
+ case 2:
297
+ queue = _context5.sent;
298
+ queueData = (0, _toConsumableArray2.default)(queue);
299
+ if (!(queueData.length === 0)) {
300
+ _context5.next = 6;
806
301
  break;
807
-
808
- case 16:
809
- if (!hash) {
810
- _context5.next = 21;
811
- break;
812
- }
813
-
814
- _context5.next = 19;
815
- return _this5.process.byHash(ObjectType, queueObject);
816
-
817
- case 19:
818
- _context5.next = 23;
302
+ }
303
+ return _context5.abrupt("return", false);
304
+ case 6:
305
+ i = 0;
306
+ case 7:
307
+ if (!(i < queueData.length)) {
308
+ _context5.next = 26;
819
309
  break;
820
-
821
- case 21:
822
- _context5.next = 23;
823
- return _this5.process.create(ObjectType, queueObject);
824
-
825
- case 23:
826
- i += 1;
827
- _context5.next = 7;
310
+ }
311
+ queueObject = queueData[i];
312
+ id = queueObject.id, hash = queueObject.hash, className = queueObject.className;
313
+ ObjectType = _ParseObject.default.extend(className);
314
+ if (!id) {
315
+ _context5.next = 16;
828
316
  break;
829
-
830
- case 26:
831
- return _context5.abrupt("return", true);
832
-
833
- case 27:
834
- case "end":
835
- return _context5.stop();
836
- }
317
+ }
318
+ _context5.next = 14;
319
+ return _this5.process.byId(ObjectType, queueObject);
320
+ case 14:
321
+ _context5.next = 23;
322
+ break;
323
+ case 16:
324
+ if (!hash) {
325
+ _context5.next = 21;
326
+ break;
327
+ }
328
+ _context5.next = 19;
329
+ return _this5.process.byHash(ObjectType, queueObject);
330
+ case 19:
331
+ _context5.next = 23;
332
+ break;
333
+ case 21:
334
+ _context5.next = 23;
335
+ return _this5.process.create(ObjectType, queueObject);
336
+ case 23:
337
+ i += 1;
338
+ _context5.next = 7;
339
+ break;
340
+ case 26:
341
+ return _context5.abrupt("return", true);
342
+ case 27:
343
+ case "end":
344
+ return _context5.stop();
837
345
  }
838
346
  }, _callee5);
839
347
  }))();
840
348
  },
841
-
842
349
  /**
843
350
  * Build queue object and add to queue.
844
351
  *
@@ -848,105 +355,76 @@ var EventuallyQueue = {
848
355
  * @static
849
356
  * @ignore
850
357
  */
851
- sendQueueCallback: function sendQueueCallback(object
852
- /*: ParseObject*/
853
- , queueObject
854
- /*: QueueObject*/
855
- )
856
- /*: Promise<void>*/
857
- {
358
+ sendQueueCallback: function (object /*: ParseObject*/, queueObject /*: QueueObject*/) /*: Promise<void>*/{
858
359
  var _this6 = this;
859
-
860
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
861
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
862
- while (1) {
863
- switch (_context6.prev = _context6.next) {
864
- case 0:
865
- if (object) {
866
- _context6.next = 2;
867
- break;
868
- }
869
-
870
- return _context6.abrupt("return", _this6.remove(queueObject.queueId));
871
-
872
- case 2:
873
- _context6.t0 = queueObject.action;
874
- _context6.next = _context6.t0 === 'save' ? 5 : _context6.t0 === 'destroy' ? 20 : 33;
360
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
361
+ return _regenerator.default.wrap(function (_context6) {
362
+ while (1) switch (_context6.prev = _context6.next) {
363
+ case 0:
364
+ if (object) {
365
+ _context6.next = 2;
875
366
  break;
876
-
877
- case 5:
878
- if (!(typeof object.updatedAt !== 'undefined' && object.updatedAt > new Date(queueObject.object.createdAt))) {
879
- _context6.next = 7;
880
- break;
881
- }
882
-
883
- return _context6.abrupt("return", _this6.remove(queueObject.queueId));
884
-
885
- case 7:
886
- _context6.prev = 7;
887
- _context6.next = 10;
888
- return object.save(queueObject.object, queueObject.serverOptions);
889
-
890
- case 10:
891
- _context6.next = 12;
892
- return _this6.remove(queueObject.queueId);
893
-
894
- case 12:
895
- _context6.next = 19;
367
+ }
368
+ return _context6.abrupt("return", _this6.remove(queueObject.queueId));
369
+ case 2:
370
+ _context6.t0 = queueObject.action;
371
+ _context6.next = _context6.t0 === 'save' ? 5 : _context6.t0 === 'destroy' ? 20 : 33;
372
+ break;
373
+ case 5:
374
+ if (!(typeof object.updatedAt !== 'undefined' && object.updatedAt > new Date(queueObject.object.createdAt))) {
375
+ _context6.next = 7;
896
376
  break;
897
-
898
- case 14:
899
- _context6.prev = 14;
900
- _context6.t1 = _context6["catch"](7);
901
-
902
- if (!(_context6.t1.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
903
- _context6.next = 19;
904
- break;
905
- }
906
-
377
+ }
378
+ return _context6.abrupt("return", _this6.remove(queueObject.queueId));
379
+ case 7:
380
+ _context6.prev = 7;
381
+ _context6.next = 10;
382
+ return object.save(queueObject.object, queueObject.serverOptions);
383
+ case 10:
384
+ _context6.next = 12;
385
+ return _this6.remove(queueObject.queueId);
386
+ case 12:
387
+ _context6.next = 19;
388
+ break;
389
+ case 14:
390
+ _context6.prev = 14;
391
+ _context6.t1 = _context6["catch"](7);
392
+ if (!(_context6.t1.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
907
393
  _context6.next = 19;
908
- return _this6.remove(queueObject.queueId);
909
-
910
- case 19:
911
- return _context6.abrupt("break", 33);
912
-
913
- case 20:
914
- _context6.prev = 20;
915
- _context6.next = 23;
916
- return object.destroy(queueObject.serverOptions);
917
-
918
- case 23:
919
- _context6.next = 25;
920
- return _this6.remove(queueObject.queueId);
921
-
922
- case 25:
923
- _context6.next = 32;
924
394
  break;
925
-
926
- case 27:
927
- _context6.prev = 27;
928
- _context6.t2 = _context6["catch"](20);
929
-
930
- if (!(_context6.t2.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
931
- _context6.next = 32;
932
- break;
933
- }
934
-
395
+ }
396
+ _context6.next = 19;
397
+ return _this6.remove(queueObject.queueId);
398
+ case 19:
399
+ return _context6.abrupt("break", 33);
400
+ case 20:
401
+ _context6.prev = 20;
402
+ _context6.next = 23;
403
+ return object.destroy(queueObject.serverOptions);
404
+ case 23:
405
+ _context6.next = 25;
406
+ return _this6.remove(queueObject.queueId);
407
+ case 25:
408
+ _context6.next = 32;
409
+ break;
410
+ case 27:
411
+ _context6.prev = 27;
412
+ _context6.t2 = _context6["catch"](20);
413
+ if (!(_context6.t2.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
935
414
  _context6.next = 32;
936
- return _this6.remove(queueObject.queueId);
937
-
938
- case 32:
939
- return _context6.abrupt("break", 33);
940
-
941
- case 33:
942
- case "end":
943
- return _context6.stop();
944
- }
415
+ break;
416
+ }
417
+ _context6.next = 32;
418
+ return _this6.remove(queueObject.queueId);
419
+ case 32:
420
+ return _context6.abrupt("break", 33);
421
+ case 33:
422
+ case "end":
423
+ return _context6.stop();
945
424
  }
946
425
  }, _callee6, null, [[7, 14], [20, 27]]);
947
426
  }))();
948
427
  },
949
-
950
428
  /**
951
429
  * Start polling server for network connection.
952
430
  * Will send queue if connection is established.
@@ -956,26 +434,18 @@ var EventuallyQueue = {
956
434
  * @param [ms] Milliseconds to ping the server. Default 2000ms
957
435
  * @static
958
436
  */
959
- poll: function poll() {
437
+ poll: function () {
960
438
  var _this7 = this;
961
-
962
- var ms
963
- /*: number*/
964
- = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2000;
965
-
439
+ var ms /*: number*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2000;
966
440
  if (polling) {
967
441
  return;
968
442
  }
969
-
970
443
  polling = (0, _setInterval2.default)(function () {
971
444
  var RESTController = _CoreManager.default.getRESTController();
972
-
973
445
  RESTController.request('GET', 'health').then(function (_ref) {
974
446
  var status = _ref.status;
975
-
976
447
  if (status === 'ok') {
977
448
  _this7.stopPoll();
978
-
979
449
  return _this7.sendQueue();
980
450
  }
981
451
  }).catch(function (e) {
@@ -983,7 +453,6 @@ var EventuallyQueue = {
983
453
  });
984
454
  }, ms);
985
455
  },
986
-
987
456
  /**
988
457
  * Turns off polling.
989
458
  *
@@ -991,11 +460,10 @@ var EventuallyQueue = {
991
460
  * @name Parse.EventuallyQueue.stopPoll
992
461
  * @static
993
462
  */
994
- stopPoll: function stopPoll() {
463
+ stopPoll: function () {
995
464
  clearInterval(polling);
996
465
  polling = undefined;
997
466
  },
998
-
999
467
  /**
1000
468
  * Return true if pinging the server.
1001
469
  *
@@ -1004,80 +472,65 @@ var EventuallyQueue = {
1004
472
  * @returns {boolean}
1005
473
  * @static
1006
474
  */
1007
- isPolling: function isPolling()
1008
- /*: boolean*/
1009
- {
475
+ isPolling: function () /*: boolean*/{
1010
476
  return !!polling;
1011
477
  },
1012
- _setPolling: function _setPolling(flag
1013
- /*: boolean*/
1014
- ) {
478
+ _setPolling: function (flag /*: boolean*/) {
1015
479
  polling = flag;
1016
480
  },
1017
481
  process: {
1018
- create: function create(ObjectType, queueObject) {
482
+ create: function (ObjectType, queueObject) {
1019
483
  var object = new ObjectType();
1020
484
  return EventuallyQueue.sendQueueCallback(object, queueObject);
1021
485
  },
1022
- byId: function byId(ObjectType, queueObject) {
1023
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
486
+ byId: function (ObjectType, queueObject) {
487
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
1024
488
  var sessionToken, query, results;
1025
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1026
- while (1) {
1027
- switch (_context7.prev = _context7.next) {
1028
- case 0:
1029
- sessionToken = queueObject.serverOptions.sessionToken;
1030
- query = new _ParseQuery.default(ObjectType);
1031
- query.equalTo('objectId', queueObject.id);
1032
- _context7.next = 5;
1033
- return (0, _find.default)(query).call(query, {
1034
- sessionToken: sessionToken
1035
- });
1036
-
1037
- case 5:
1038
- results = _context7.sent;
1039
- return _context7.abrupt("return", EventuallyQueue.sendQueueCallback(results[0], queueObject));
1040
-
1041
- case 7:
1042
- case "end":
1043
- return _context7.stop();
1044
- }
489
+ return _regenerator.default.wrap(function (_context7) {
490
+ while (1) switch (_context7.prev = _context7.next) {
491
+ case 0:
492
+ sessionToken = queueObject.serverOptions.sessionToken;
493
+ query = new _ParseQuery.default(ObjectType);
494
+ query.equalTo('objectId', queueObject.id);
495
+ _context7.next = 5;
496
+ return (0, _find.default)(query).call(query, {
497
+ sessionToken: sessionToken
498
+ });
499
+ case 5:
500
+ results = _context7.sent;
501
+ return _context7.abrupt("return", EventuallyQueue.sendQueueCallback(results[0], queueObject));
502
+ case 7:
503
+ case "end":
504
+ return _context7.stop();
1045
505
  }
1046
506
  }, _callee7);
1047
507
  }))();
1048
508
  },
1049
- byHash: function byHash(ObjectType, queueObject) {
1050
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
509
+ byHash: function (ObjectType, queueObject) {
510
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1051
511
  var sessionToken, query, results;
1052
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1053
- while (1) {
1054
- switch (_context8.prev = _context8.next) {
1055
- case 0:
1056
- sessionToken = queueObject.serverOptions.sessionToken;
1057
- query = new _ParseQuery.default(ObjectType);
1058
- query.equalTo('hash', queueObject.hash);
1059
- _context8.next = 5;
1060
- return (0, _find.default)(query).call(query, {
1061
- sessionToken: sessionToken
1062
- });
1063
-
1064
- case 5:
1065
- results = _context8.sent;
1066
-
1067
- if (!(results.length > 0)) {
1068
- _context8.next = 8;
1069
- break;
1070
- }
1071
-
1072
- return _context8.abrupt("return", EventuallyQueue.sendQueueCallback(results[0], queueObject));
1073
-
1074
- case 8:
1075
- return _context8.abrupt("return", EventuallyQueue.process.create(ObjectType, queueObject));
1076
-
1077
- case 9:
1078
- case "end":
1079
- return _context8.stop();
1080
- }
512
+ return _regenerator.default.wrap(function (_context8) {
513
+ while (1) switch (_context8.prev = _context8.next) {
514
+ case 0:
515
+ sessionToken = queueObject.serverOptions.sessionToken;
516
+ query = new _ParseQuery.default(ObjectType);
517
+ query.equalTo('hash', queueObject.hash);
518
+ _context8.next = 5;
519
+ return (0, _find.default)(query).call(query, {
520
+ sessionToken: sessionToken
521
+ });
522
+ case 5:
523
+ results = _context8.sent;
524
+ if (!(results.length > 0)) {
525
+ _context8.next = 8;
526
+ break;
527
+ }
528
+ return _context8.abrupt("return", EventuallyQueue.sendQueueCallback(results[0], queueObject));
529
+ case 8:
530
+ return _context8.abrupt("return", EventuallyQueue.process.create(ObjectType, queueObject));
531
+ case 9:
532
+ case "end":
533
+ return _context8.stop();
1081
534
  }
1082
535
  }, _callee8);
1083
536
  }))();