parse 4.0.0-alpha.7 → 4.0.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/LICENSE +167 -25
  2. package/NOTICE +10 -0
  3. package/README.md +1 -3
  4. package/dist/parse.js +3942 -6528
  5. package/dist/parse.min.js +7 -6
  6. package/dist/parse.weapp.js +3103 -6459
  7. package/dist/parse.weapp.min.js +7 -6
  8. package/lib/browser/Analytics.js +4 -11
  9. package/lib/browser/AnonymousUtils.js +2 -9
  10. package/lib/browser/Cloud.js +4 -11
  11. package/lib/browser/CloudCode.js +0 -1
  12. package/lib/browser/CoreManager.js +3 -10
  13. package/lib/browser/EventEmitter.js +0 -7
  14. package/lib/browser/EventuallyQueue.js +282 -668
  15. package/lib/browser/FacebookUtils.js +2 -9
  16. package/lib/browser/InstallationController.js +0 -7
  17. package/lib/browser/LiveQueryClient.js +35 -26
  18. package/lib/browser/LiveQuerySubscription.js +5 -4
  19. package/lib/browser/LocalDatastore.js +472 -864
  20. package/lib/browser/LocalDatastoreController.js +161 -547
  21. package/lib/browser/LocalDatastoreController.react-native.js +156 -537
  22. package/lib/browser/LocalDatastoreUtils.js +2 -9
  23. package/lib/browser/ObjectStateMutations.js +25 -25
  24. package/lib/browser/OfflineQuery.js +31 -33
  25. package/lib/browser/Parse.js +4 -13
  26. package/lib/browser/ParseACL.js +9 -16
  27. package/lib/browser/ParseCLP.js +46 -48
  28. package/lib/browser/ParseConfig.js +6 -13
  29. package/lib/browser/ParseError.js +2 -11
  30. package/lib/browser/ParseFile.js +107 -482
  31. package/lib/browser/ParseGeoPoint.js +4 -11
  32. package/lib/browser/ParseHooks.js +2 -2
  33. package/lib/browser/ParseInstallation.js +2 -2
  34. package/lib/browser/ParseLiveQuery.js +104 -480
  35. package/lib/browser/ParseObject.js +549 -935
  36. package/lib/browser/ParseOp.js +11 -11
  37. package/lib/browser/ParsePolygon.js +5 -12
  38. package/lib/browser/ParseQuery.js +365 -758
  39. package/lib/browser/ParseRelation.js +2 -9
  40. package/lib/browser/ParseRole.js +2 -2
  41. package/lib/browser/ParseSchema.js +2 -9
  42. package/lib/browser/ParseSession.js +2 -2
  43. package/lib/browser/ParseUser.js +221 -607
  44. package/lib/browser/Push.js +2 -9
  45. package/lib/browser/RESTController.js +12 -19
  46. package/lib/browser/SingleInstanceStateController.js +4 -11
  47. package/lib/browser/Storage.js +0 -7
  48. package/lib/browser/StorageController.browser.js +0 -7
  49. package/lib/browser/StorageController.default.js +0 -7
  50. package/lib/browser/StorageController.react-native.js +0 -7
  51. package/lib/browser/StorageController.weapp.js +0 -7
  52. package/lib/browser/TaskQueue.js +0 -7
  53. package/lib/browser/UniqueInstanceStateController.js +8 -15
  54. package/lib/browser/arrayContainsObject.js +2 -9
  55. package/lib/browser/canBeSerialized.js +2 -9
  56. package/lib/browser/decode.js +4 -11
  57. package/lib/browser/encode.js +8 -15
  58. package/lib/browser/equals.js +4 -13
  59. package/lib/browser/escape.js +0 -7
  60. package/lib/browser/isRevocableSession.js +2 -9
  61. package/lib/browser/parseDate.js +2 -9
  62. package/lib/browser/promiseUtils.js +4 -4
  63. package/lib/browser/unique.js +4 -11
  64. package/lib/browser/unsavedChildren.js +6 -13
  65. package/lib/browser/uuid.js +5 -1
  66. package/lib/node/Analytics.js +0 -7
  67. package/lib/node/AnonymousUtils.js +0 -7
  68. package/lib/node/Cloud.js +0 -7
  69. package/lib/node/CloudCode.js +0 -1
  70. package/lib/node/CoreManager.js +1 -8
  71. package/lib/node/EventEmitter.js +0 -7
  72. package/lib/node/FacebookUtils.js +0 -7
  73. package/lib/node/InstallationController.js +0 -7
  74. package/lib/node/LiveQueryClient.js +18 -17
  75. package/lib/node/LiveQuerySubscription.js +2 -11
  76. package/lib/node/LocalDatastore.js +0 -7
  77. package/lib/node/LocalDatastoreController.js +0 -7
  78. package/lib/node/LocalDatastoreController.react-native.js +0 -7
  79. package/lib/node/LocalDatastoreUtils.js +0 -7
  80. package/lib/node/ObjectStateMutations.js +0 -7
  81. package/lib/node/Parse.js +0 -9
  82. package/lib/node/ParseACL.js +0 -7
  83. package/lib/node/ParseCLP.js +0 -7
  84. package/lib/node/ParseConfig.js +0 -7
  85. package/lib/node/ParseError.js +0 -9
  86. package/lib/node/ParseFile.js +7 -12
  87. package/lib/node/ParseGeoPoint.js +0 -7
  88. package/lib/node/ParseInstallation.js +0 -7
  89. package/lib/node/ParseLiveQuery.js +0 -7
  90. package/lib/node/ParseObject.js +10 -14
  91. package/lib/node/ParseOp.js +0 -7
  92. package/lib/node/ParsePolygon.js +0 -7
  93. package/lib/node/ParseQuery.js +3 -18
  94. package/lib/node/ParseRelation.js +0 -7
  95. package/lib/node/ParseRole.js +0 -7
  96. package/lib/node/ParseSchema.js +0 -7
  97. package/lib/node/ParseSession.js +0 -7
  98. package/lib/node/ParseUser.js +0 -7
  99. package/lib/node/Push.js +0 -7
  100. package/lib/node/RESTController.js +0 -7
  101. package/lib/node/SingleInstanceStateController.js +0 -7
  102. package/lib/node/Storage.js +0 -7
  103. package/lib/node/StorageController.browser.js +0 -7
  104. package/lib/node/StorageController.default.js +0 -7
  105. package/lib/node/StorageController.react-native.js +0 -7
  106. package/lib/node/StorageController.weapp.js +0 -7
  107. package/lib/node/TaskQueue.js +0 -7
  108. package/lib/node/UniqueInstanceStateController.js +0 -7
  109. package/lib/node/arrayContainsObject.js +0 -7
  110. package/lib/node/canBeSerialized.js +0 -7
  111. package/lib/node/decode.js +0 -7
  112. package/lib/node/encode.js +0 -7
  113. package/lib/node/equals.js +0 -9
  114. package/lib/node/escape.js +0 -7
  115. package/lib/node/isRevocableSession.js +0 -7
  116. package/lib/node/parseDate.js +0 -7
  117. package/lib/node/unique.js +0 -7
  118. package/lib/node/unsavedChildren.js +0 -7
  119. package/lib/node/uuid.js +7 -1
  120. package/lib/react-native/CoreManager.js +2 -2
  121. package/lib/react-native/EventuallyQueue.js +169 -676
  122. package/lib/react-native/LiveQueryClient.js +16 -50
  123. package/lib/react-native/LiveQuerySubscription.js +3 -2
  124. package/lib/react-native/LocalDatastore.js +303 -863
  125. package/lib/react-native/LocalDatastoreController.js +75 -535
  126. package/lib/react-native/LocalDatastoreController.react-native.js +95 -503
  127. package/lib/react-native/ObjectStateMutations.js +2 -31
  128. package/lib/react-native/OfflineQuery.js +17 -63
  129. package/lib/react-native/ParseCLP.js +55 -129
  130. package/lib/react-native/ParseFile.js +63 -468
  131. package/lib/react-native/ParseLiveQuery.js +60 -455
  132. package/lib/react-native/ParseObject.js +225 -878
  133. package/lib/react-native/ParseQuery.js +207 -643
  134. package/lib/react-native/ParseSchema.js +3 -3
  135. package/lib/react-native/ParseUser.js +118 -573
  136. package/lib/react-native/RESTController.js +1 -29
  137. package/lib/react-native/uuid.js +5 -1
  138. package/lib/weapp/Analytics.js +4 -11
  139. package/lib/weapp/AnonymousUtils.js +2 -9
  140. package/lib/weapp/Cloud.js +4 -11
  141. package/lib/weapp/CloudCode.js +0 -1
  142. package/lib/weapp/CoreManager.js +3 -10
  143. package/lib/weapp/EventEmitter.js +0 -7
  144. package/lib/weapp/EventuallyQueue.js +282 -668
  145. package/lib/weapp/FacebookUtils.js +2 -9
  146. package/lib/weapp/InstallationController.js +0 -7
  147. package/lib/weapp/LiveQueryClient.js +35 -26
  148. package/lib/weapp/LiveQuerySubscription.js +5 -4
  149. package/lib/weapp/LocalDatastore.js +472 -864
  150. package/lib/weapp/LocalDatastoreController.js +161 -547
  151. package/lib/weapp/LocalDatastoreController.react-native.js +156 -537
  152. package/lib/weapp/LocalDatastoreUtils.js +2 -9
  153. package/lib/weapp/ObjectStateMutations.js +25 -25
  154. package/lib/weapp/OfflineQuery.js +31 -33
  155. package/lib/weapp/Parse.js +4 -13
  156. package/lib/weapp/ParseACL.js +9 -16
  157. package/lib/weapp/ParseCLP.js +46 -48
  158. package/lib/weapp/ParseConfig.js +6 -13
  159. package/lib/weapp/ParseError.js +2 -11
  160. package/lib/weapp/ParseFile.js +107 -482
  161. package/lib/weapp/ParseGeoPoint.js +4 -11
  162. package/lib/weapp/ParseHooks.js +2 -2
  163. package/lib/weapp/ParseInstallation.js +2 -2
  164. package/lib/weapp/ParseLiveQuery.js +104 -480
  165. package/lib/weapp/ParseObject.js +549 -935
  166. package/lib/weapp/ParseOp.js +11 -11
  167. package/lib/weapp/ParsePolygon.js +5 -12
  168. package/lib/weapp/ParseQuery.js +365 -758
  169. package/lib/weapp/ParseRelation.js +2 -9
  170. package/lib/weapp/ParseRole.js +2 -2
  171. package/lib/weapp/ParseSchema.js +2 -9
  172. package/lib/weapp/ParseSession.js +2 -2
  173. package/lib/weapp/ParseUser.js +221 -607
  174. package/lib/weapp/Push.js +2 -9
  175. package/lib/weapp/RESTController.js +12 -19
  176. package/lib/weapp/SingleInstanceStateController.js +4 -11
  177. package/lib/weapp/Storage.js +0 -7
  178. package/lib/weapp/StorageController.browser.js +0 -7
  179. package/lib/weapp/StorageController.default.js +0 -7
  180. package/lib/weapp/StorageController.react-native.js +0 -7
  181. package/lib/weapp/StorageController.weapp.js +0 -7
  182. package/lib/weapp/TaskQueue.js +0 -7
  183. package/lib/weapp/UniqueInstanceStateController.js +8 -15
  184. package/lib/weapp/arrayContainsObject.js +2 -9
  185. package/lib/weapp/canBeSerialized.js +2 -9
  186. package/lib/weapp/decode.js +4 -11
  187. package/lib/weapp/encode.js +8 -15
  188. package/lib/weapp/equals.js +4 -13
  189. package/lib/weapp/escape.js +0 -7
  190. package/lib/weapp/isRevocableSession.js +2 -9
  191. package/lib/weapp/parseDate.js +2 -9
  192. package/lib/weapp/promiseUtils.js +4 -4
  193. package/lib/weapp/unique.js +4 -11
  194. package/lib/weapp/unsavedChildren.js +6 -13
  195. package/lib/weapp/uuid.js +2 -0
  196. package/package.json +24 -24
  197. package/PATENTS +0 -37
@@ -5,393 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
-
10
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
9
 
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+
12
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
13
 
14
14
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
15
 
16
16
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
17
17
 
18
- function ownKeys(object, enumerableOnly) {
19
- var keys = Object.keys(object);
20
-
21
- if (Object.getOwnPropertySymbols) {
22
- var symbols = Object.getOwnPropertySymbols(object);
23
- enumerableOnly && (symbols = symbols.filter(function (sym) {
24
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
25
- })), keys.push.apply(keys, symbols);
26
- }
27
-
28
- return keys;
29
- }
30
-
31
- function _objectSpread(target) {
32
- for (var i = 1; i < arguments.length; i++) {
33
- var source = null != arguments[i] ? arguments[i] : {};
34
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
35
- (0, _defineProperty2.default)(target, key, source[key]);
36
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
37
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
38
- });
39
- }
40
-
41
- return target;
42
- }
43
-
44
- function _regeneratorRuntime() {
45
- "use strict";
46
-
47
- _regeneratorRuntime = function () {
48
- return exports;
49
- };
50
-
51
- var exports = {},
52
- Op = Object.prototype,
53
- hasOwn = Op.hasOwnProperty,
54
- $Symbol = "function" == typeof Symbol ? Symbol : {},
55
- iteratorSymbol = $Symbol.iterator || "@@iterator",
56
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
57
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
58
-
59
- function define(obj, key, value) {
60
- return Object.defineProperty(obj, key, {
61
- value: value,
62
- enumerable: !0,
63
- configurable: !0,
64
- writable: !0
65
- }), obj[key];
66
- }
67
-
68
- try {
69
- define({}, "");
70
- } catch (err) {
71
- define = function (obj, key, value) {
72
- return obj[key] = value;
73
- };
74
- }
75
-
76
- function wrap(innerFn, outerFn, self, tryLocsList) {
77
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
78
- generator = Object.create(protoGenerator.prototype),
79
- context = new Context(tryLocsList || []);
80
- return generator._invoke = function (innerFn, self, context) {
81
- var state = "suspendedStart";
82
- return function (method, arg) {
83
- if ("executing" === state) throw new Error("Generator is already running");
84
-
85
- if ("completed" === state) {
86
- if ("throw" === method) throw arg;
87
- return doneResult();
88
- }
89
-
90
- for (context.method = method, context.arg = arg;;) {
91
- var delegate = context.delegate;
92
-
93
- if (delegate) {
94
- var delegateResult = maybeInvokeDelegate(delegate, context);
95
-
96
- if (delegateResult) {
97
- if (delegateResult === ContinueSentinel) continue;
98
- return delegateResult;
99
- }
100
- }
101
-
102
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
103
- if ("suspendedStart" === state) throw state = "completed", context.arg;
104
- context.dispatchException(context.arg);
105
- } else "return" === context.method && context.abrupt("return", context.arg);
106
- state = "executing";
107
- var record = tryCatch(innerFn, self, context);
108
-
109
- if ("normal" === record.type) {
110
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
111
- return {
112
- value: record.arg,
113
- done: context.done
114
- };
115
- }
116
-
117
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
118
- }
119
- };
120
- }(innerFn, self, context), generator;
121
- }
122
-
123
- function tryCatch(fn, obj, arg) {
124
- try {
125
- return {
126
- type: "normal",
127
- arg: fn.call(obj, arg)
128
- };
129
- } catch (err) {
130
- return {
131
- type: "throw",
132
- arg: err
133
- };
134
- }
135
- }
136
-
137
- exports.wrap = wrap;
138
- var ContinueSentinel = {};
139
-
140
- function Generator() {}
141
-
142
- function GeneratorFunction() {}
143
-
144
- function GeneratorFunctionPrototype() {}
145
-
146
- var IteratorPrototype = {};
147
- define(IteratorPrototype, iteratorSymbol, function () {
148
- return this;
149
- });
150
- var getProto = Object.getPrototypeOf,
151
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
152
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
153
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
154
-
155
- function defineIteratorMethods(prototype) {
156
- ["next", "throw", "return"].forEach(function (method) {
157
- define(prototype, method, function (arg) {
158
- return this._invoke(method, arg);
159
- });
160
- });
161
- }
162
-
163
- function AsyncIterator(generator, PromiseImpl) {
164
- function invoke(method, arg, resolve, reject) {
165
- var record = tryCatch(generator[method], generator, arg);
166
-
167
- if ("throw" !== record.type) {
168
- var result = record.arg,
169
- value = result.value;
170
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
171
- invoke("next", value, resolve, reject);
172
- }, function (err) {
173
- invoke("throw", err, resolve, reject);
174
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
175
- result.value = unwrapped, resolve(result);
176
- }, function (error) {
177
- return invoke("throw", error, resolve, reject);
178
- });
179
- }
180
-
181
- reject(record.arg);
182
- }
183
-
184
- var previousPromise;
185
-
186
- this._invoke = function (method, arg) {
187
- function callInvokeWithMethodAndArg() {
188
- return new PromiseImpl(function (resolve, reject) {
189
- invoke(method, arg, resolve, reject);
190
- });
191
- }
192
-
193
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
194
- };
195
- }
196
-
197
- function maybeInvokeDelegate(delegate, context) {
198
- var method = delegate.iterator[context.method];
199
-
200
- if (undefined === method) {
201
- if (context.delegate = null, "throw" === context.method) {
202
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
203
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
204
- }
205
-
206
- return ContinueSentinel;
207
- }
208
-
209
- var record = tryCatch(method, delegate.iterator, context.arg);
210
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
211
- var info = record.arg;
212
- 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);
213
- }
214
-
215
- function pushTryEntry(locs) {
216
- var entry = {
217
- tryLoc: locs[0]
218
- };
219
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
220
- }
221
-
222
- function resetTryEntry(entry) {
223
- var record = entry.completion || {};
224
- record.type = "normal", delete record.arg, entry.completion = record;
225
- }
226
-
227
- function Context(tryLocsList) {
228
- this.tryEntries = [{
229
- tryLoc: "root"
230
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
231
- }
232
-
233
- function values(iterable) {
234
- if (iterable) {
235
- var iteratorMethod = iterable[iteratorSymbol];
236
- if (iteratorMethod) return iteratorMethod.call(iterable);
237
- if ("function" == typeof iterable.next) return iterable;
238
-
239
- if (!isNaN(iterable.length)) {
240
- var i = -1,
241
- next = function next() {
242
- for (; ++i < iterable.length;) {
243
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
244
- }
245
-
246
- return next.value = undefined, next.done = !0, next;
247
- };
248
-
249
- return next.next = next;
250
- }
251
- }
252
-
253
- return {
254
- next: doneResult
255
- };
256
- }
257
-
258
- function doneResult() {
259
- return {
260
- value: undefined,
261
- done: !0
262
- };
263
- }
264
-
265
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
266
- var ctor = "function" == typeof genFun && genFun.constructor;
267
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
268
- }, exports.mark = function (genFun) {
269
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
270
- }, exports.awrap = function (arg) {
271
- return {
272
- __await: arg
273
- };
274
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
275
- return this;
276
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
277
- void 0 === PromiseImpl && (PromiseImpl = Promise);
278
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
279
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
280
- return result.done ? result.value : iter.next();
281
- });
282
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
283
- return this;
284
- }), define(Gp, "toString", function () {
285
- return "[object Generator]";
286
- }), exports.keys = function (object) {
287
- var keys = [];
288
-
289
- for (var key in object) {
290
- keys.push(key);
291
- }
292
-
293
- return keys.reverse(), function next() {
294
- for (; keys.length;) {
295
- var key = keys.pop();
296
- if (key in object) return next.value = key, next.done = !1, next;
297
- }
298
-
299
- return next.done = !0, next;
300
- };
301
- }, exports.values = values, Context.prototype = {
302
- constructor: Context,
303
- reset: function (skipTempReset) {
304
- 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) {
305
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
306
- }
307
- },
308
- stop: function () {
309
- this.done = !0;
310
- var rootRecord = this.tryEntries[0].completion;
311
- if ("throw" === rootRecord.type) throw rootRecord.arg;
312
- return this.rval;
313
- },
314
- dispatchException: function (exception) {
315
- if (this.done) throw exception;
316
- var context = this;
317
-
318
- function handle(loc, caught) {
319
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
320
- }
321
-
322
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
323
- var entry = this.tryEntries[i],
324
- record = entry.completion;
325
- if ("root" === entry.tryLoc) return handle("end");
326
-
327
- if (entry.tryLoc <= this.prev) {
328
- var hasCatch = hasOwn.call(entry, "catchLoc"),
329
- hasFinally = hasOwn.call(entry, "finallyLoc");
330
-
331
- if (hasCatch && hasFinally) {
332
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
333
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
334
- } else if (hasCatch) {
335
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
336
- } else {
337
- if (!hasFinally) throw new Error("try statement without catch or finally");
338
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
339
- }
340
- }
341
- }
342
- },
343
- abrupt: function (type, arg) {
344
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
345
- var entry = this.tryEntries[i];
346
-
347
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
348
- var finallyEntry = entry;
349
- break;
350
- }
351
- }
352
-
353
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
354
- var record = finallyEntry ? finallyEntry.completion : {};
355
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
356
- },
357
- complete: function (record, afterLoc) {
358
- if ("throw" === record.type) throw record.arg;
359
- 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;
360
- },
361
- finish: function (finallyLoc) {
362
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
363
- var entry = this.tryEntries[i];
364
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
365
- }
366
- },
367
- catch: function (tryLoc) {
368
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
369
- var entry = this.tryEntries[i];
370
-
371
- if (entry.tryLoc === tryLoc) {
372
- var record = entry.completion;
373
-
374
- if ("throw" === record.type) {
375
- var thrown = record.arg;
376
- resetTryEntry(entry);
377
- }
378
-
379
- return thrown;
380
- }
381
- }
382
-
383
- throw new Error("illegal catch attempt");
384
- },
385
- delegateYield: function (iterable, resultName, nextLoc) {
386
- return this.delegate = {
387
- iterator: values(iterable),
388
- resultName: resultName,
389
- nextLoc: nextLoc
390
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
391
- }
392
- }, exports;
393
- }
394
-
395
18
  var ParseError = require('./ParseError').default;
396
19
 
397
20
  var XHR = null;
@@ -470,50 +93,34 @@ var ParseFile = function () {
470
93
  (0, _createClass2.default)(ParseFile, [{
471
94
  key: "getData",
472
95
  value: function () {
473
- var _this = this;
474
-
475
- var options, controller, result;
476
- return _regeneratorRuntime().async(function (_context) {
477
- while (1) {
478
- switch (_context.prev = _context.next) {
479
- case 0:
480
- if (!this._data) {
481
- _context.next = 2;
482
- break;
483
- }
484
-
485
- return _context.abrupt("return", this._data);
486
-
487
- case 2:
488
- if (this._url) {
489
- _context.next = 4;
490
- break;
491
- }
492
-
493
- throw new Error('Cannot retrieve data for unsaved ParseFile.');
494
-
495
- case 4:
496
- options = {
497
- requestTask: function (task) {
498
- return _this._requestTask = task;
499
- }
500
- };
501
- controller = _CoreManager.default.getFileController();
502
- _context.next = 8;
503
- return _regeneratorRuntime().awrap(controller.download(this._url, options));
504
-
505
- case 8:
506
- result = _context.sent;
507
- this._data = result.base64;
508
- return _context.abrupt("return", this._data);
509
-
510
- case 11:
511
- case "end":
512
- return _context.stop();
513
- }
96
+ var _getData = (0, _asyncToGenerator2.default)(function* () {
97
+ var _this = this;
98
+
99
+ if (this._data) {
100
+ return this._data;
514
101
  }
515
- }, null, this, null, Promise);
516
- }
102
+
103
+ if (!this._url) {
104
+ throw new Error('Cannot retrieve data for unsaved ParseFile.');
105
+ }
106
+
107
+ var controller = _CoreManager.default.getFileController();
108
+
109
+ var result = yield controller.download(this._url, {
110
+ requestTask: function (task) {
111
+ return _this._requestTask = task;
112
+ }
113
+ });
114
+ this._data = result.base64;
115
+ return this._data;
116
+ });
117
+
118
+ function getData() {
119
+ return _getData.apply(this, arguments);
120
+ }
121
+
122
+ return getData;
123
+ }()
517
124
  }, {
518
125
  key: "name",
519
126
  value: function () {
@@ -726,58 +333,46 @@ var ParseFile = function () {
726
333
  }();
727
334
 
728
335
  var DefaultController = {
729
- saveFile: function (name, source, options) {
730
- var base64Data, _base64Data$split, _base64Data$split2, first, second, data, newSource;
731
-
732
- return _regeneratorRuntime().async(function (_context2) {
733
- while (1) {
734
- switch (_context2.prev = _context2.next) {
735
- case 0:
736
- if (!(source.format !== 'file')) {
737
- _context2.next = 2;
738
- break;
739
- }
336
+ saveFile: function () {
337
+ var _saveFile = (0, _asyncToGenerator2.default)(function* (name, source, options) {
338
+ if (source.format !== 'file') {
339
+ throw new Error('saveFile can only be used with File-type sources.');
340
+ }
740
341
 
741
- throw new Error('saveFile can only be used with File-type sources.');
342
+ var base64Data = yield new Promise(function (res, rej) {
343
+ var reader = new FileReader();
742
344
 
743
- case 2:
744
- _context2.next = 4;
745
- return _regeneratorRuntime().awrap(new Promise(function (res, rej) {
746
- var reader = new FileReader();
345
+ reader.onload = function () {
346
+ return res(reader.result);
347
+ };
747
348
 
748
- reader.onload = function () {
749
- return res(reader.result);
750
- };
349
+ reader.onerror = function (error) {
350
+ return rej(error);
351
+ };
751
352
 
752
- reader.onerror = function (error) {
753
- return rej(error);
754
- };
353
+ reader.readAsDataURL(source.file);
354
+ });
755
355
 
756
- reader.readAsDataURL(source.file);
757
- }));
356
+ var _base64Data$split = base64Data.split(','),
357
+ _base64Data$split2 = (0, _slicedToArray2.default)(_base64Data$split, 2),
358
+ first = _base64Data$split2[0],
359
+ second = _base64Data$split2[1];
758
360
 
759
- case 4:
760
- base64Data = _context2.sent;
761
- _base64Data$split = base64Data.split(','), _base64Data$split2 = (0, _slicedToArray2.default)(_base64Data$split, 2), first = _base64Data$split2[0], second = _base64Data$split2[1];
762
- data = second ? second : first;
763
- newSource = {
764
- format: 'base64',
765
- base64: data,
766
- type: source.type || (source.file ? source.file.type : null)
767
- };
768
- _context2.next = 10;
769
- return _regeneratorRuntime().awrap(DefaultController.saveBase64(name, newSource, options));
361
+ var data = second ? second : first;
362
+ var newSource = {
363
+ format: 'base64',
364
+ base64: data,
365
+ type: source.type || (source.file ? source.file.type : null)
366
+ };
367
+ return yield DefaultController.saveBase64(name, newSource, options);
368
+ });
770
369
 
771
- case 10:
772
- return _context2.abrupt("return", _context2.sent);
370
+ function saveFile() {
371
+ return _saveFile.apply(this, arguments);
372
+ }
773
373
 
774
- case 11:
775
- case "end":
776
- return _context2.stop();
777
- }
778
- }
779
- }, null, null, null, Promise);
780
- },
374
+ return saveFile;
375
+ }(),
781
376
  saveBase64: function (name, source, options) {
782
377
  if (source.format !== 'base64') {
783
378
  throw new Error('saveBase64 can only be used with Base64-type sources.');
@@ -786,8 +381,8 @@ var DefaultController = {
786
381
  var data = {
787
382
  base64: source.base64,
788
383
  fileData: {
789
- metadata: _objectSpread({}, options.metadata),
790
- tags: _objectSpread({}, options.tags)
384
+ metadata: Object.assign({}, options.metadata),
385
+ tags: Object.assign({}, options.tags)
791
386
  }
792
387
  };
793
388
  delete options.metadata;