parse 3.5.0 → 3.5.1-alpha.2

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 (50) hide show
  1. package/README.md +2 -1
  2. package/dist/parse.js +422 -347
  3. package/dist/parse.min.js +2 -2
  4. package/dist/parse.weapp.js +422 -347
  5. package/dist/parse.weapp.min.js +2 -2
  6. package/lib/browser/CoreManager.js +1 -1
  7. package/lib/browser/EventuallyQueue.js +31 -27
  8. package/lib/browser/LiveQueryClient.js +6 -2
  9. package/lib/browser/LocalDatastore.js +20 -20
  10. package/lib/browser/LocalDatastoreController.js +16 -14
  11. package/lib/browser/LocalDatastoreController.react-native.js +10 -10
  12. package/lib/browser/ParseCLP.js +32 -32
  13. package/lib/browser/ParseFile.js +27 -15
  14. package/lib/browser/ParseLiveQuery.js +6 -6
  15. package/lib/browser/ParseObject.js +84 -69
  16. package/lib/browser/ParseOp.js +3 -1
  17. package/lib/browser/ParseQuery.js +115 -88
  18. package/lib/browser/ParseUser.js +74 -64
  19. package/lib/browser/RESTController.js +6 -7
  20. package/lib/browser/StorageController.react-native.js +7 -12
  21. package/lib/node/CoreManager.js +1 -1
  22. package/lib/node/ParseFile.js +1 -0
  23. package/lib/node/ParseQuery.js +3 -1
  24. package/lib/node/StorageController.react-native.js +7 -13
  25. package/lib/react-native/CoreManager.js +1 -1
  26. package/lib/react-native/LiveQueryClient.js +6 -2
  27. package/lib/react-native/LocalDatastore.js +3 -2
  28. package/lib/react-native/ParseCLP.js +32 -32
  29. package/lib/react-native/ParseFile.js +10 -3
  30. package/lib/react-native/ParseObject.js +14 -9
  31. package/lib/react-native/ParseOp.js +3 -1
  32. package/lib/react-native/ParseQuery.js +21 -7
  33. package/lib/react-native/RESTController.js +6 -7
  34. package/lib/react-native/StorageController.react-native.js +7 -10
  35. package/lib/weapp/CoreManager.js +1 -1
  36. package/lib/weapp/EventuallyQueue.js +31 -27
  37. package/lib/weapp/LiveQueryClient.js +6 -2
  38. package/lib/weapp/LocalDatastore.js +20 -20
  39. package/lib/weapp/LocalDatastoreController.js +16 -14
  40. package/lib/weapp/LocalDatastoreController.react-native.js +10 -10
  41. package/lib/weapp/ParseCLP.js +32 -32
  42. package/lib/weapp/ParseFile.js +27 -15
  43. package/lib/weapp/ParseLiveQuery.js +6 -6
  44. package/lib/weapp/ParseObject.js +84 -69
  45. package/lib/weapp/ParseOp.js +3 -1
  46. package/lib/weapp/ParseQuery.js +115 -88
  47. package/lib/weapp/ParseUser.js +74 -64
  48. package/lib/weapp/RESTController.js +6 -7
  49. package/lib/weapp/StorageController.react-native.js +7 -12
  50. package/package.json +3 -2
@@ -23,19 +23,13 @@ function _interopRequireDefault(obj) {
23
23
  const StorageController = {
24
24
  async: 1,
25
25
 
26
- getAsyncStorage()
27
- /*: any*/
28
- {
29
- return _CoreManager.default.getAsyncStorage();
30
- },
31
-
32
26
  getItemAsync(path
33
27
  /*: string*/
34
28
  )
35
29
  /*: Promise*/
36
30
  {
37
31
  return new Promise((resolve, reject) => {
38
- this.getAsyncStorage().getItem(path, function (err, value) {
32
+ _CoreManager.default.getAsyncStorage().getItem(path, (err, value) => {
39
33
  if (err) {
40
34
  reject(err);
41
35
  } else {
@@ -53,7 +47,7 @@ const StorageController = {
53
47
  /*: Promise*/
54
48
  {
55
49
  return new Promise((resolve, reject) => {
56
- this.getAsyncStorage().setItem(path, value, function (err, value) {
50
+ _CoreManager.default.getAsyncStorage().setItem(path, value, (err, value) => {
57
51
  if (err) {
58
52
  reject(err);
59
53
  } else {
@@ -69,7 +63,7 @@ const StorageController = {
69
63
  /*: Promise*/
70
64
  {
71
65
  return new Promise((resolve, reject) => {
72
- this.getAsyncStorage().removeItem(path, function (err) {
66
+ _CoreManager.default.getAsyncStorage().removeItem(path, err => {
73
67
  if (err) {
74
68
  reject(err);
75
69
  } else {
@@ -83,7 +77,7 @@ const StorageController = {
83
77
  /*: Promise*/
84
78
  {
85
79
  return new Promise((resolve, reject) => {
86
- this.getAsyncStorage().getAllKeys(function (err, keys) {
80
+ _CoreManager.default.getAsyncStorage().getAllKeys((err, keys) => {
87
81
  if (err) {
88
82
  reject(err);
89
83
  } else {
@@ -99,7 +93,7 @@ const StorageController = {
99
93
  /*: Promise<Array<Array<string>>>*/
100
94
  {
101
95
  return new Promise((resolve, reject) => {
102
- this.getAsyncStorage().multiGet(keys, function (err, result) {
96
+ _CoreManager.default.getAsyncStorage().multiGet(keys, (err, result) => {
103
97
  if (err) {
104
98
  reject(err);
105
99
  } else {
@@ -115,7 +109,7 @@ const StorageController = {
115
109
  /*: Promise*/
116
110
  {
117
111
  return new Promise((resolve, reject) => {
118
- this.getAsyncStorage().multiRemove(keys, function (err) {
112
+ _CoreManager.default.getAsyncStorage().multiRemove(keys, err => {
119
113
  if (err) {
120
114
  reject(err);
121
115
  } else {
@@ -126,7 +120,7 @@ const StorageController = {
126
120
  },
127
121
 
128
122
  clear() {
129
- return this.getAsyncStorage().clear();
123
+ return _CoreManager.default.getAsyncStorage().clear();
130
124
  }
131
125
 
132
126
  };
@@ -8,7 +8,7 @@ var config = {
8
8
  SERVER_AUTH_TOKEN: null,
9
9
  LIVEQUERY_SERVER_URL: null,
10
10
  ENCRYPTED_KEY: null,
11
- VERSION: 'js' + "3.5.0",
11
+ VERSION: 'js' + "3.5.1-alpha.2",
12
12
  APPLICATION_ID: null,
13
13
  JAVASCRIPT_KEY: null,
14
14
  MASTER_KEY: null,
@@ -190,6 +190,8 @@ var LiveQueryClient = function (_EventEmitter) {
190
190
  }, {
191
191
  key: "subscribe",
192
192
  value: function (query, sessionToken) {
193
+ var _this2 = this;
194
+
193
195
  if (!query) {
194
196
  return;
195
197
  }
@@ -216,13 +218,15 @@ var LiveQueryClient = function (_EventEmitter) {
216
218
  this.subscriptions.set(this.requestId, subscription);
217
219
  this.requestId += 1;
218
220
  this.connectPromise.then(function () {
219
- this.socket.send(JSON.stringify(subscribeRequest));
221
+ _this2.socket.send(JSON.stringify(subscribeRequest));
220
222
  });
221
223
  return subscription;
222
224
  }
223
225
  }, {
224
226
  key: "unsubscribe",
225
227
  value: function (subscription) {
228
+ var _this3 = this;
229
+
226
230
  if (!subscription) {
227
231
  return;
228
232
  }
@@ -233,7 +237,7 @@ var LiveQueryClient = function (_EventEmitter) {
233
237
  requestId: subscription.id
234
238
  };
235
239
  this.connectPromise.then(function () {
236
- this.socket.send(JSON.stringify(unsubscribeRequest));
240
+ _this3.socket.send(JSON.stringify(unsubscribeRequest));
237
241
  });
238
242
  }
239
243
  }, {
@@ -616,7 +616,8 @@ var LocalDatastore = {
616
616
  }
617
617
  },
618
618
  _serializeObjectsFromPinName: function (name) {
619
- var _ref;
619
+ var _this = this,
620
+ _ref;
620
621
 
621
622
  var localDatastore, allObjects, key, pinName, pinned, promises, objects;
622
623
  return _regeneratorRuntime().async(function (_context3) {
@@ -656,7 +657,7 @@ var LocalDatastore = {
656
657
 
657
658
  case 11:
658
659
  promises = pinned.map(function (objectKey) {
659
- return this.fromPinWithName(objectKey);
660
+ return _this.fromPinWithName(objectKey);
660
661
  });
661
662
  _context3.next = 14;
662
663
  return _regeneratorRuntime().awrap(Promise.all(promises));
@@ -104,7 +104,7 @@ var ParseCLP = function () {
104
104
  (0, _classCallCheck2.default)(this, ParseCLP);
105
105
  this.permissionsMap = {};
106
106
 
107
- var _loop = function (operation, group) {
107
+ var _loop = function _loop(operation, group) {
108
108
  _this.permissionsMap[operation] = (0, _extends2.default)({}, group);
109
109
  var action = operation.charAt(0).toUpperCase() + operation.slice(1);
110
110
 
@@ -217,12 +217,12 @@ var ParseCLP = function () {
217
217
 
218
218
  (0, _createClass2.default)(ParseCLP, [{
219
219
  key: "toJSON",
220
- value: function () {
220
+ value: function toJSON() {
221
221
  return _objectSpread({}, this.permissionsMap);
222
222
  }
223
223
  }, {
224
224
  key: "equals",
225
- value: function (other) {
225
+ value: function equals(other) {
226
226
  if (!(other instanceof ParseCLP)) {
227
227
  return false;
228
228
  }
@@ -261,7 +261,7 @@ var ParseCLP = function () {
261
261
  }
262
262
  }, {
263
263
  key: "_getRoleName",
264
- value: function (role) {
264
+ value: function _getRoleName(role) {
265
265
  var name = role;
266
266
 
267
267
  if (role instanceof _ParseRole.default) {
@@ -276,7 +276,7 @@ var ParseCLP = function () {
276
276
  }
277
277
  }, {
278
278
  key: "_parseEntity",
279
- value: function (entity) {
279
+ value: function _parseEntity(entity) {
280
280
  var userId = entity;
281
281
 
282
282
  if (userId instanceof _ParseUser.default) {
@@ -297,7 +297,7 @@ var ParseCLP = function () {
297
297
  }
298
298
  }, {
299
299
  key: "_setAccess",
300
- value: function (permission, userId, allowed) {
300
+ value: function _setAccess(permission, userId, allowed) {
301
301
  userId = this._parseEntity(userId);
302
302
 
303
303
  if (typeof allowed !== 'boolean') {
@@ -322,7 +322,7 @@ var ParseCLP = function () {
322
322
  }
323
323
  }, {
324
324
  key: "_getAccess",
325
- value: function (permission, userId) {
325
+ value: function _getAccess(permission, userId) {
326
326
  var returnBoolean = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
327
327
  userId = this._parseEntity(userId);
328
328
  var permissions = this.permissionsMap[permission][userId];
@@ -339,7 +339,7 @@ var ParseCLP = function () {
339
339
  }
340
340
  }, {
341
341
  key: "_setArrayAccess",
342
- value: function (permission, userId, fields) {
342
+ value: function _setArrayAccess(permission, userId, fields) {
343
343
  userId = this._parseEntity(userId);
344
344
  var permissions = this.permissionsMap[permission][userId];
345
345
 
@@ -359,7 +359,7 @@ var ParseCLP = function () {
359
359
  }
360
360
  }, {
361
361
  key: "_setGroupPointerPermission",
362
- value: function (operation, pointerFields) {
362
+ value: function _setGroupPointerPermission(operation, pointerFields) {
363
363
  var fields = this.permissionsMap[operation];
364
364
 
365
365
  if (!fields) {
@@ -378,42 +378,42 @@ var ParseCLP = function () {
378
378
  }
379
379
  }, {
380
380
  key: "_getGroupPointerPermissions",
381
- value: function (operation) {
381
+ value: function _getGroupPointerPermissions(operation) {
382
382
  return this.permissionsMap[operation];
383
383
  }
384
384
  }, {
385
385
  key: "setReadUserFields",
386
- value: function (pointerFields) {
386
+ value: function setReadUserFields(pointerFields) {
387
387
  this._setGroupPointerPermission('readUserFields', pointerFields);
388
388
  }
389
389
  }, {
390
390
  key: "getReadUserFields",
391
- value: function () {
391
+ value: function getReadUserFields() {
392
392
  return this._getGroupPointerPermissions('readUserFields');
393
393
  }
394
394
  }, {
395
395
  key: "setWriteUserFields",
396
- value: function (pointerFields) {
396
+ value: function setWriteUserFields(pointerFields) {
397
397
  this._setGroupPointerPermission('writeUserFields', pointerFields);
398
398
  }
399
399
  }, {
400
400
  key: "getWriteUserFields",
401
- value: function () {
401
+ value: function getWriteUserFields() {
402
402
  return this._getGroupPointerPermissions('writeUserFields');
403
403
  }
404
404
  }, {
405
405
  key: "setProtectedFields",
406
- value: function (userId, fields) {
406
+ value: function setProtectedFields(userId, fields) {
407
407
  this._setArrayAccess('protectedFields', userId, fields);
408
408
  }
409
409
  }, {
410
410
  key: "getProtectedFields",
411
- value: function (userId) {
411
+ value: function getProtectedFields(userId) {
412
412
  return this._getAccess('protectedFields', userId, false);
413
413
  }
414
414
  }, {
415
415
  key: "setReadAccess",
416
- value: function (userId, allowed) {
416
+ value: function setReadAccess(userId, allowed) {
417
417
  this._setAccess('find', userId, allowed);
418
418
 
419
419
  this._setAccess('get', userId, allowed);
@@ -422,12 +422,12 @@ var ParseCLP = function () {
422
422
  }
423
423
  }, {
424
424
  key: "getReadAccess",
425
- value: function (userId) {
425
+ value: function getReadAccess(userId) {
426
426
  return this._getAccess('find', userId) && this._getAccess('get', userId) && this._getAccess('count', userId);
427
427
  }
428
428
  }, {
429
429
  key: "setWriteAccess",
430
- value: function (userId, allowed) {
430
+ value: function setWriteAccess(userId, allowed) {
431
431
  this._setAccess('create', userId, allowed);
432
432
 
433
433
  this._setAccess('update', userId, allowed);
@@ -438,67 +438,67 @@ var ParseCLP = function () {
438
438
  }
439
439
  }, {
440
440
  key: "getWriteAccess",
441
- value: function (userId) {
441
+ value: function getWriteAccess(userId) {
442
442
  return this._getAccess('create', userId) && this._getAccess('update', userId) && this._getAccess('delete', userId) && this._getAccess('addField', userId);
443
443
  }
444
444
  }, {
445
445
  key: "setPublicReadAccess",
446
- value: function (allowed) {
446
+ value: function setPublicReadAccess(allowed) {
447
447
  this.setReadAccess(PUBLIC_KEY, allowed);
448
448
  }
449
449
  }, {
450
450
  key: "getPublicReadAccess",
451
- value: function () {
451
+ value: function getPublicReadAccess() {
452
452
  return this.getReadAccess(PUBLIC_KEY);
453
453
  }
454
454
  }, {
455
455
  key: "setPublicWriteAccess",
456
- value: function (allowed) {
456
+ value: function setPublicWriteAccess(allowed) {
457
457
  this.setWriteAccess(PUBLIC_KEY, allowed);
458
458
  }
459
459
  }, {
460
460
  key: "getPublicWriteAccess",
461
- value: function () {
461
+ value: function getPublicWriteAccess() {
462
462
  return this.getWriteAccess(PUBLIC_KEY);
463
463
  }
464
464
  }, {
465
465
  key: "setPublicProtectedFields",
466
- value: function (fields) {
466
+ value: function setPublicProtectedFields(fields) {
467
467
  this.setProtectedFields(PUBLIC_KEY, fields);
468
468
  }
469
469
  }, {
470
470
  key: "getPublicProtectedFields",
471
- value: function () {
471
+ value: function getPublicProtectedFields() {
472
472
  return this.getProtectedFields(PUBLIC_KEY);
473
473
  }
474
474
  }, {
475
475
  key: "getRoleReadAccess",
476
- value: function (role) {
476
+ value: function getRoleReadAccess(role) {
477
477
  return this.getReadAccess(this._getRoleName(role));
478
478
  }
479
479
  }, {
480
480
  key: "getRoleWriteAccess",
481
- value: function (role) {
481
+ value: function getRoleWriteAccess(role) {
482
482
  return this.getWriteAccess(this._getRoleName(role));
483
483
  }
484
484
  }, {
485
485
  key: "setRoleReadAccess",
486
- value: function (role, allowed) {
486
+ value: function setRoleReadAccess(role, allowed) {
487
487
  this.setReadAccess(this._getRoleName(role), allowed);
488
488
  }
489
489
  }, {
490
490
  key: "setRoleWriteAccess",
491
- value: function (role, allowed) {
491
+ value: function setRoleWriteAccess(role, allowed) {
492
492
  this.setWriteAccess(this._getRoleName(role), allowed);
493
493
  }
494
494
  }, {
495
495
  key: "getRoleProtectedFields",
496
- value: function (role) {
496
+ value: function getRoleProtectedFields(role) {
497
497
  return this.getProtectedFields(this._getRoleName(role));
498
498
  }
499
499
  }, {
500
500
  key: "setRoleProtectedFields",
501
- value: function (role, fields) {
501
+ value: function setRoleProtectedFields(role, fields) {
502
502
  this.setProtectedFields(this._getRoleName(role), fields);
503
503
  }
504
504
  }]);
@@ -455,6 +455,7 @@ var ParseFile = function () {
455
455
  } else if (data && typeof data.base64 === 'string') {
456
456
  var base64 = data.base64.split(',').slice(-1)[0];
457
457
  var dataType = specifiedType || data.base64.split(';').slice(0, 1)[0].split(':').slice(1, 2)[0] || 'text/plain';
458
+ this._data = base64;
458
459
  this._source = {
459
460
  format: 'base64',
460
461
  base64: base64,
@@ -469,6 +470,8 @@ var ParseFile = function () {
469
470
  (0, _createClass2.default)(ParseFile, [{
470
471
  key: "getData",
471
472
  value: function () {
473
+ var _this = this;
474
+
472
475
  var options, controller, result;
473
476
  return _regeneratorRuntime().async(function (_context) {
474
477
  while (1) {
@@ -492,7 +495,7 @@ var ParseFile = function () {
492
495
  case 4:
493
496
  options = {
494
497
  requestTask: function (task) {
495
- return this._requestTask = task;
498
+ return _this._requestTask = task;
496
499
  }
497
500
  };
498
501
  controller = _CoreManager.default.getFileController();
@@ -657,9 +660,11 @@ var ParseFile = function () {
657
660
  }, {
658
661
  key: "setMetadata",
659
662
  value: function (metadata) {
663
+ var _this4 = this;
664
+
660
665
  if (metadata && typeof metadata === 'object') {
661
666
  Object.keys(metadata).forEach(function (key) {
662
- this.addMetadata(key, metadata[key]);
667
+ _this4.addMetadata(key, metadata[key]);
663
668
  });
664
669
  }
665
670
  }
@@ -673,9 +678,11 @@ var ParseFile = function () {
673
678
  }, {
674
679
  key: "setTags",
675
680
  value: function (tags) {
681
+ var _this5 = this;
682
+
676
683
  if (tags && typeof tags === 'object') {
677
684
  Object.keys(tags).forEach(function (key) {
678
- this.addTag(key, tags[key]);
685
+ _this5.addTag(key, tags[key]);
679
686
  });
680
687
  }
681
688
  }
@@ -1517,6 +1517,8 @@ var ParseObject = function () {
1517
1517
  }, {
1518
1518
  key: "save",
1519
1519
  value: function (arg1, arg2, arg3) {
1520
+ var _this = this;
1521
+
1520
1522
  var attrs;
1521
1523
  var options;
1522
1524
 
@@ -1565,7 +1567,7 @@ var ParseObject = function () {
1565
1567
 
1566
1568
  var unsaved = options.cascadeSave !== false ? (0, _unsavedChildren.default)(this) : null;
1567
1569
  return controller.save(unsaved, saveOptions).then(function () {
1568
- return controller.save(this, saveOptions);
1570
+ return controller.save(_this, saveOptions);
1569
1571
  });
1570
1572
  }
1571
1573
  }, {
@@ -2503,8 +2505,8 @@ var DefaultController = {
2503
2505
  batch.forEach(function (obj, index) {
2504
2506
  var ready = new _promiseUtils.resolvingPromise();
2505
2507
  batchReady.push(ready);
2506
- stateController.pushPendingState(obj._getStateIdentifier());
2507
- batchTasks.push(stateController.enqueueTask(obj._getStateIdentifier(), function () {
2508
+
2509
+ var task = function task() {
2508
2510
  ready.resolve();
2509
2511
  return batchReturned.then(function (responses) {
2510
2512
  if (responses[index].hasOwnProperty('success')) {
@@ -2524,7 +2526,10 @@ var DefaultController = {
2524
2526
  obj._handleSaveError();
2525
2527
  }
2526
2528
  });
2527
- }));
2529
+ };
2530
+
2531
+ stateController.pushPendingState(obj._getStateIdentifier());
2532
+ batchTasks.push(stateController.enqueueTask(obj._getStateIdentifier(), task));
2528
2533
  });
2529
2534
  (0, _promiseUtils.when)(batchReady).then(function () {
2530
2535
  return RESTController.request('POST', 'batch', {
@@ -2539,10 +2544,10 @@ var DefaultController = {
2539
2544
  batchReturned.reject(new _ParseError.default(_ParseError.default.INCORRECT_TYPE, error.message));
2540
2545
  });
2541
2546
  return (0, _promiseUtils.when)(batchTasks);
2542
- }).then(function () {
2547
+ }).then(function _callee5() {
2543
2548
  var _iterator4, _step4, object;
2544
2549
 
2545
- return _regeneratorRuntime().async(function (_context11) {
2550
+ return _regeneratorRuntime().async(function _callee5$(_context11) {
2546
2551
  while (1) {
2547
2552
  switch (_context11.prev = _context11.next) {
2548
2553
  case 0:
@@ -2595,7 +2600,7 @@ var DefaultController = {
2595
2600
  var localId = target._localId;
2596
2601
  var targetCopy = target;
2597
2602
 
2598
- var task = function () {
2603
+ var task = function task() {
2599
2604
  var params = targetCopy._getSaveParams();
2600
2605
 
2601
2606
  return RESTController.request(params.method, params.path, params.body, options).then(function (response) {
@@ -2611,8 +2616,8 @@ var DefaultController = {
2611
2616
  };
2612
2617
 
2613
2618
  stateController.pushPendingState(target._getStateIdentifier());
2614
- return stateController.enqueueTask(target._getStateIdentifier(), task).then(function () {
2615
- return _regeneratorRuntime().async(function (_context12) {
2619
+ return stateController.enqueueTask(target._getStateIdentifier(), task).then(function _callee6() {
2620
+ return _regeneratorRuntime().async(function _callee6$(_context12) {
2616
2621
  while (1) {
2617
2622
  switch (_context12.prev = _context12.next) {
2618
2623
  case 0:
@@ -648,10 +648,12 @@ var RelationOp = function (_Op7) {
648
648
  }, {
649
649
  key: "toJSON",
650
650
  value: function () {
651
+ var _this7 = this;
652
+
651
653
  var idToPointer = function (id) {
652
654
  return {
653
655
  __type: 'Pointer',
654
- className: this._targetClassName,
656
+ className: _this7._targetClassName,
655
657
  objectId: id
656
658
  };
657
659
  };
@@ -1012,6 +1012,8 @@ var ParseQuery = function () {
1012
1012
  }, {
1013
1013
  key: "first",
1014
1014
  value: function (options) {
1015
+ var _this4 = this;
1016
+
1015
1017
  options = options || {};
1016
1018
  var findOptions = {};
1017
1019
 
@@ -1053,7 +1055,7 @@ var ParseQuery = function () {
1053
1055
  }
1054
1056
 
1055
1057
  if (!objects[0].className) {
1056
- objects[0].className = this.className;
1058
+ objects[0].className = _this4.className;
1057
1059
  }
1058
1060
 
1059
1061
  if (select) {
@@ -1221,6 +1223,8 @@ var ParseQuery = function () {
1221
1223
  }, {
1222
1224
  key: "map",
1223
1225
  value: function (callback, options) {
1226
+ var _this5 = this;
1227
+
1224
1228
  var array, index;
1225
1229
  return _regeneratorRuntime().async(function (_context4) {
1226
1230
  while (1) {
@@ -1230,7 +1234,7 @@ var ParseQuery = function () {
1230
1234
  index = 0;
1231
1235
  _context4.next = 4;
1232
1236
  return _regeneratorRuntime().awrap(this.each(function (object) {
1233
- return Promise.resolve(callback(object, index, this)).then(function (result) {
1237
+ return Promise.resolve(callback(object, index, _this5)).then(function (result) {
1234
1238
  array.push(result);
1235
1239
  index += 1;
1236
1240
  });
@@ -1291,6 +1295,8 @@ var ParseQuery = function () {
1291
1295
  }, {
1292
1296
  key: "filter",
1293
1297
  value: function (callback, options) {
1298
+ var _this6 = this;
1299
+
1294
1300
  var array, index;
1295
1301
  return _regeneratorRuntime().async(function (_context6) {
1296
1302
  while (1) {
@@ -1300,7 +1306,7 @@ var ParseQuery = function () {
1300
1306
  index = 0;
1301
1307
  _context6.next = 4;
1302
1308
  return _regeneratorRuntime().awrap(this.each(function (object) {
1303
- return Promise.resolve(callback(object, index, this)).then(function (flag) {
1309
+ return Promise.resolve(callback(object, index, _this6)).then(function (flag) {
1304
1310
  if (flag) {
1305
1311
  array.push(object);
1306
1312
  }
@@ -1322,13 +1328,15 @@ var ParseQuery = function () {
1322
1328
  }, {
1323
1329
  key: "equalTo",
1324
1330
  value: function (key, value) {
1331
+ var _this7 = this;
1332
+
1325
1333
  if (key && typeof key === 'object') {
1326
1334
  Object.entries(key).forEach(function (_ref) {
1327
1335
  var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
1328
1336
  k = _ref2[0],
1329
1337
  val = _ref2[1];
1330
1338
 
1331
- return this.equalTo(k, val);
1339
+ return _this7.equalTo(k, val);
1332
1340
  });
1333
1341
  return this;
1334
1342
  }
@@ -1343,13 +1351,15 @@ var ParseQuery = function () {
1343
1351
  }, {
1344
1352
  key: "notEqualTo",
1345
1353
  value: function (key, value) {
1354
+ var _this8 = this;
1355
+
1346
1356
  if (key && typeof key === 'object') {
1347
1357
  Object.entries(key).forEach(function (_ref3) {
1348
1358
  var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
1349
1359
  k = _ref4[0],
1350
1360
  val = _ref4[1];
1351
1361
 
1352
- return this.notEqualTo(k, val);
1362
+ return _this8.notEqualTo(k, val);
1353
1363
  });
1354
1364
  return this;
1355
1365
  }
@@ -1399,13 +1409,15 @@ var ParseQuery = function () {
1399
1409
  }, {
1400
1410
  key: "containsAllStartingWith",
1401
1411
  value: function (key, values) {
1412
+ var _this = this;
1413
+
1402
1414
  if (!Array.isArray(values)) {
1403
1415
  values = [values];
1404
1416
  }
1405
1417
 
1406
1418
  var regexObject = values.map(function (value) {
1407
1419
  return {
1408
- $regex: this._regexStartWith(value)
1420
+ $regex: _this._regexStartWith(value)
1409
1421
  };
1410
1422
  });
1411
1423
  return this.containsAll(key, regexObject);
@@ -1859,6 +1871,8 @@ var ParseQuery = function () {
1859
1871
  }, {
1860
1872
  key: "cancel",
1861
1873
  value: function () {
1874
+ var _this14 = this;
1875
+
1862
1876
  if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {
1863
1877
  this._xhrRequest.task._aborted = true;
1864
1878
 
@@ -1872,7 +1886,7 @@ var ParseQuery = function () {
1872
1886
  }
1873
1887
 
1874
1888
  return this._xhrRequest.onchange = function () {
1875
- return this.cancel();
1889
+ return _this14.cancel();
1876
1890
  };
1877
1891
  }
1878
1892
  }, {
@@ -104,7 +104,7 @@ var RESTController = {
104
104
  var requestId = isIdempotent ? uuidv4() : '';
105
105
  var attempts = 0;
106
106
 
107
- var dispatch = function dispatch() {
107
+ (function dispatch() {
108
108
  if (XHR == null) {
109
109
  throw new Error('Cannot make a request: No definition of XMLHttpRequest was found.');
110
110
  }
@@ -228,12 +228,11 @@ var RESTController = {
228
228
  if (options && typeof options.requestTask === 'function') {
229
229
  options.requestTask(xhr);
230
230
  }
231
- };
231
+ })();
232
232
 
233
- dispatch();
234
233
  return promise;
235
234
  },
236
- request: function (method, path, data, options) {
235
+ request: function request(method, path, data, options) {
237
236
  options = options || {};
238
237
 
239
238
  var url = _CoreManager.default.get('SERVER_URL');
@@ -339,7 +338,7 @@ var RESTController = {
339
338
  });
340
339
  }).catch(RESTController.handleError);
341
340
  },
342
- handleError: function (response) {
341
+ handleError: function handleError(response) {
343
342
  var error;
344
343
 
345
344
  if (response && response.responseText) {
@@ -356,10 +355,10 @@ var RESTController = {
356
355
 
357
356
  return Promise.reject(error);
358
357
  },
359
- _setXHR: function (xhr) {
358
+ _setXHR: function _setXHR(xhr) {
360
359
  XHR = xhr;
361
360
  },
362
- _getXHR: function () {
361
+ _getXHR: function _getXHR() {
363
362
  return XHR;
364
363
  }
365
364
  };