parse 4.1.0 → 4.2.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/parse.js +2123 -1542
  2. package/dist/parse.min.js +2 -2
  3. package/dist/parse.weapp.js +2105 -1524
  4. package/dist/parse.weapp.min.js +2 -2
  5. package/lib/browser/AnonymousUtils.js +1 -1
  6. package/lib/browser/Cloud.js +4 -2
  7. package/lib/browser/CoreManager.js +31 -4
  8. package/lib/browser/EventEmitter.js +7 -2
  9. package/lib/browser/EventuallyQueue.js +24 -4
  10. package/lib/browser/LiveQueryClient.js +59 -89
  11. package/lib/browser/LiveQuerySubscription.js +16 -51
  12. package/lib/browser/LocalDatastore.js +10 -1
  13. package/lib/browser/LocalDatastoreController.js +3 -1
  14. package/lib/browser/ObjectStateMutations.js +17 -2
  15. package/lib/browser/OfflineQuery.js +1 -1
  16. package/lib/browser/Parse.js +171 -135
  17. package/lib/browser/ParseACL.js +2 -1
  18. package/lib/browser/ParseCLP.js +6 -1
  19. package/lib/browser/ParseConfig.js +1 -0
  20. package/lib/browser/ParseError.js +12 -1
  21. package/lib/browser/ParseFile.js +5 -1
  22. package/lib/browser/ParseInstallation.js +4 -1
  23. package/lib/browser/ParseLiveQuery.js +79 -51
  24. package/lib/browser/ParseObject.js +11 -8
  25. package/lib/browser/ParseOp.js +3 -1
  26. package/lib/browser/ParseQuery.js +122 -72
  27. package/lib/browser/ParseRole.js +5 -1
  28. package/lib/browser/ParseSchema.js +23 -2
  29. package/lib/browser/ParseSession.js +1 -1
  30. package/lib/browser/ParseUser.js +107 -9
  31. package/lib/browser/Push.js +8 -2
  32. package/lib/browser/RESTController.js +20 -0
  33. package/lib/browser/SingleInstanceStateController.js +6 -1
  34. package/lib/browser/Storage.js +7 -0
  35. package/lib/browser/TaskQueue.js +4 -0
  36. package/lib/browser/UniqueInstanceStateController.js +3 -1
  37. package/lib/browser/unsavedChildren.js +4 -1
  38. package/lib/node/AnonymousUtils.js +1 -1
  39. package/lib/node/Cloud.js +4 -2
  40. package/lib/node/CoreManager.js +30 -4
  41. package/lib/node/EventEmitter.js +7 -1
  42. package/lib/node/EventuallyQueue.js +23 -4
  43. package/lib/node/LiveQueryClient.js +10 -7
  44. package/lib/node/LiveQuerySubscription.js +5 -7
  45. package/lib/node/LocalDatastore.js +7 -1
  46. package/lib/node/ObjectStateMutations.js +14 -2
  47. package/lib/node/OfflineQuery.js +1 -1
  48. package/lib/node/Parse.js +162 -126
  49. package/lib/node/ParseACL.js +2 -1
  50. package/lib/node/ParseCLP.js +3 -1
  51. package/lib/node/ParseConfig.js +1 -2
  52. package/lib/node/ParseError.js +15 -1
  53. package/lib/node/ParseFile.js +2 -1
  54. package/lib/node/ParseInstallation.js +1 -1
  55. package/lib/node/ParseLiveQuery.js +32 -24
  56. package/lib/node/ParseObject.js +3 -2
  57. package/lib/node/ParseQuery.js +53 -7
  58. package/lib/node/ParseRole.js +2 -1
  59. package/lib/node/ParseSchema.js +21 -2
  60. package/lib/node/ParseSession.js +1 -5
  61. package/lib/node/ParseUser.js +95 -9
  62. package/lib/node/Push.js +8 -2
  63. package/lib/node/RESTController.js +20 -0
  64. package/lib/node/SingleInstanceStateController.js +6 -1
  65. package/lib/node/Storage.js +6 -0
  66. package/lib/node/TaskQueue.js +4 -1
  67. package/lib/node/UniqueInstanceStateController.js +3 -1
  68. package/lib/node/unsavedChildren.js +4 -1
  69. package/lib/react-native/Cloud.js +3 -0
  70. package/lib/react-native/CoreManager.js +30 -4
  71. package/lib/react-native/EventEmitter.js +8 -5
  72. package/lib/react-native/EventuallyQueue.js +10 -3
  73. package/lib/react-native/LiveQueryClient.js +44 -70
  74. package/lib/react-native/LiveQuerySubscription.js +16 -46
  75. package/lib/react-native/LocalDatastore.js +6 -0
  76. package/lib/react-native/ObjectStateMutations.js +3 -1
  77. package/lib/react-native/OfflineQuery.js +1 -1
  78. package/lib/react-native/Parse.js +127 -90
  79. package/lib/react-native/ParseCLP.js +2 -2
  80. package/lib/react-native/ParseError.js +8 -1
  81. package/lib/react-native/ParseFile.js +1 -0
  82. package/lib/react-native/ParseLiveQuery.js +39 -11
  83. package/lib/react-native/ParseQuery.js +37 -17
  84. package/lib/react-native/ParseSchema.js +14 -1
  85. package/lib/react-native/ParseUser.js +74 -6
  86. package/lib/react-native/Storage.js +6 -0
  87. package/lib/weapp/AnonymousUtils.js +1 -1
  88. package/lib/weapp/Cloud.js +4 -2
  89. package/lib/weapp/CoreManager.js +31 -4
  90. package/lib/weapp/EventEmitter.js +7 -2
  91. package/lib/weapp/EventuallyQueue.js +24 -4
  92. package/lib/weapp/LiveQueryClient.js +59 -89
  93. package/lib/weapp/LiveQuerySubscription.js +16 -51
  94. package/lib/weapp/LocalDatastore.js +10 -1
  95. package/lib/weapp/LocalDatastoreController.js +3 -1
  96. package/lib/weapp/ObjectStateMutations.js +17 -2
  97. package/lib/weapp/OfflineQuery.js +1 -1
  98. package/lib/weapp/Parse.js +170 -134
  99. package/lib/weapp/ParseACL.js +2 -1
  100. package/lib/weapp/ParseCLP.js +6 -1
  101. package/lib/weapp/ParseConfig.js +1 -0
  102. package/lib/weapp/ParseError.js +12 -1
  103. package/lib/weapp/ParseFile.js +5 -1
  104. package/lib/weapp/ParseInstallation.js +4 -1
  105. package/lib/weapp/ParseLiveQuery.js +79 -51
  106. package/lib/weapp/ParseObject.js +11 -8
  107. package/lib/weapp/ParseOp.js +3 -1
  108. package/lib/weapp/ParseQuery.js +122 -72
  109. package/lib/weapp/ParseRole.js +5 -1
  110. package/lib/weapp/ParseSchema.js +23 -2
  111. package/lib/weapp/ParseSession.js +1 -1
  112. package/lib/weapp/ParseUser.js +107 -9
  113. package/lib/weapp/Push.js +8 -2
  114. package/lib/weapp/RESTController.js +20 -0
  115. package/lib/weapp/SingleInstanceStateController.js +6 -1
  116. package/lib/weapp/Storage.js +7 -0
  117. package/lib/weapp/TaskQueue.js +4 -0
  118. package/lib/weapp/UniqueInstanceStateController.js +3 -1
  119. package/lib/weapp/unsavedChildren.js +4 -1
  120. package/package.json +29 -25
@@ -184,7 +184,11 @@ function _objectSpread(target) {
184
184
  });
185
185
  }
186
186
  return target;
187
- }
187
+ } /**
188
+ * @flow
189
+ */
190
+ /*:: import type { AttributeMap, OpsMap } from './ObjectStateMutations';*/
191
+ /*:: import type { RequestOptions, FullOptions } from './RESTController';*/
188
192
  var uuidv4 = require('./uuid');
189
193
  /*:: export type Pointer = {
190
194
  __type: string,
@@ -250,6 +254,11 @@ var ParseObject = /*#__PURE__*/function () {
250
254
  */
251
255
  function ParseObject(className /*: ?string | { className: string, [attr: string]: mixed }*/, attributes /*:: ?: { [attr: string]: mixed }*/, options /*:: ?: { ignoreValidation: boolean }*/) {
252
256
  (0, _classCallCheck2.default)(this, ParseObject);
257
+ /**
258
+ * The ID of this object, unique within its class.
259
+ *
260
+ * @property {string} id
261
+ */
253
262
  (0, _defineProperty2.default)(this, "id", void 0);
254
263
  (0, _defineProperty2.default)(this, "_localId", void 0);
255
264
  (0, _defineProperty2.default)(this, "_objCount", void 0);
@@ -281,12 +290,6 @@ var ParseObject = /*#__PURE__*/function () {
281
290
  throw new Error("Can't create an invalid Parse Object");
282
291
  }
283
292
  }
284
-
285
- /**
286
- * The ID of this object, unique within its class.
287
- *
288
- * @property {string} id
289
- */
290
293
  (0, _createClass2.default)(ParseObject, [{
291
294
  key: "attributes",
292
295
  get: /* Prototype getters / setters */
@@ -1268,7 +1271,7 @@ var ParseObject = /*#__PURE__*/function () {
1268
1271
  /**
1269
1272
  * Returns the ACL for this object.
1270
1273
  *
1271
- * @returns {Parse.ACL} An instance of Parse.ACL.
1274
+ * @returns {Parse.ACL|null} An instance of Parse.ACL.
1272
1275
  * @see Parse.Object#get
1273
1276
  */
1274
1277
  }, {
@@ -51,7 +51,9 @@ function _isNativeReflectConstruct() {
51
51
  } catch (e) {
52
52
  return false;
53
53
  }
54
- }
54
+ } /**
55
+ * @flow
56
+ */
55
57
  function opFromJSON(json /*: { [key: string]: any }*/) /*: ?Op*/{
56
58
  if (!json || !json.__op) {
57
59
  return null;
@@ -40,7 +40,29 @@ var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
40
40
  /*
41
41
  * @flow
42
42
  */
43
-
43
+ /*:: import type LiveQuerySubscription from './LiveQuerySubscription';*/
44
+ /*:: import type { RequestOptions, FullOptions } from './RESTController';*/
45
+ /*:: type BatchOptions = FullOptions & { batchSize?: number };*/
46
+ /*:: export type WhereClause = {
47
+ [attr: string]: mixed,
48
+ };*/
49
+ /*:: export type QueryJSON = {
50
+ where: WhereClause,
51
+ watch?: string,
52
+ include?: string,
53
+ excludeKeys?: string,
54
+ keys?: string,
55
+ limit?: number,
56
+ skip?: number,
57
+ order?: string,
58
+ className?: string,
59
+ count?: number,
60
+ hint?: mixed,
61
+ explain?: boolean,
62
+ readPreference?: string,
63
+ includeReadPreference?: string,
64
+ subqueryReadPreference?: string,
65
+ };*/
44
66
  /**
45
67
  * Converts a string into a regex that matches it.
46
68
  * Surrounding with \Q .. \E does this, we just need to escape any \E's in
@@ -215,17 +237,17 @@ function handleOfflineSort(a, b, sorts) {
215
237
  * @alias Parse.Query
216
238
  */
217
239
  var ParseQuery = /*#__PURE__*/function () {
218
- /**
219
- * @property {string} className
220
- */
221
-
222
240
  /**
223
241
  * @param {(string | Parse.Object)} objectClass An instance of a subclass of Parse.Object, or a Parse className string.
224
242
  */
225
243
  function ParseQuery(objectClass /*: string | ParseObject*/) {
226
244
  (0, _classCallCheck2.default)(this, ParseQuery);
245
+ /**
246
+ * @property {string} className
247
+ */
227
248
  (0, _defineProperty2.default)(this, "className", void 0);
228
249
  (0, _defineProperty2.default)(this, "_where", void 0);
250
+ (0, _defineProperty2.default)(this, "_watch", void 0);
229
251
  (0, _defineProperty2.default)(this, "_include", void 0);
230
252
  (0, _defineProperty2.default)(this, "_exclude", void 0);
231
253
  (0, _defineProperty2.default)(this, "_select", void 0);
@@ -261,6 +283,7 @@ var ParseQuery = /*#__PURE__*/function () {
261
283
  throw new TypeError('A ParseQuery must be constructed with a ParseObject or class name.');
262
284
  }
263
285
  this._where = {};
286
+ this._watch = [];
264
287
  this._include = [];
265
288
  this._exclude = [];
266
289
  this._count = false;
@@ -453,6 +476,9 @@ var ParseQuery = /*#__PURE__*/function () {
453
476
  var params /*: QueryJSON*/ = {
454
477
  where: this._where
455
478
  };
479
+ if (this._watch.length) {
480
+ params.watch = this._watch.join(',');
481
+ }
456
482
  if (this._include.length) {
457
483
  params.include = this._include.join(',');
458
484
  }
@@ -522,6 +548,9 @@ var ParseQuery = /*#__PURE__*/function () {
522
548
  if (json.where) {
523
549
  this._where = json.where;
524
550
  }
551
+ if (json.watch) {
552
+ this._watch = json.watch.split(',');
553
+ }
525
554
  if (json.include) {
526
555
  this._include = json.include.split(',');
527
556
  }
@@ -936,21 +965,16 @@ var ParseQuery = /*#__PURE__*/function () {
936
965
  }, {
937
966
  key: "eachBatch",
938
967
  value: function (callback /*: (objs: Array<ParseObject>) => Promise<*>*/, options /*:: ?: BatchOptions*/) /*: Promise<void>*/{
939
- var _context8;
940
968
  options = options || {};
941
969
  if (this._order || this._skip || this._limit >= 0) {
942
970
  return _promise.default.reject('Cannot iterate on a query with sort, skip, or limit.');
943
971
  }
944
972
  var query = new ParseQuery(this.className);
945
973
  query._limit = options.batchSize || 100;
946
- query._include = (0, _map2.default)(_context8 = this._include).call(_context8, function (i) {
947
- return i;
948
- });
974
+ query._include = (0, _toConsumableArray2.default)(this._include);
975
+ query._exclude = (0, _toConsumableArray2.default)(this._exclude);
949
976
  if (this._select) {
950
- var _context9;
951
- query._select = (0, _map2.default)(_context9 = this._select).call(_context9, function (s) {
952
- return s;
953
- });
977
+ query._select = (0, _toConsumableArray2.default)(this._select);
954
978
  }
955
979
  query._hint = this._hint;
956
980
  query._where = {};
@@ -990,39 +1014,39 @@ var ParseQuery = /*#__PURE__*/function () {
990
1014
  return !finished;
991
1015
  }, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
992
1016
  var _yield$Promise$all, _yield$Promise$all2, results;
993
- return _regenerator.default.wrap(function (_context10) {
994
- while (1) switch (_context10.prev = _context10.next) {
1017
+ return _regenerator.default.wrap(function (_context8) {
1018
+ while (1) switch (_context8.prev = _context8.next) {
995
1019
  case 0:
996
- _context10.next = 2;
1020
+ _context8.next = 2;
997
1021
  return _promise.default.all([(0, _find.default)(query).call(query, findOptions), _promise.default.resolve(previousResults.length > 0 && callback(previousResults))]);
998
1022
  case 2:
999
- _yield$Promise$all = _context10.sent;
1023
+ _yield$Promise$all = _context8.sent;
1000
1024
  _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 1);
1001
1025
  results = _yield$Promise$all2[0];
1002
1026
  if (!(results.length >= query._limit)) {
1003
- _context10.next = 10;
1027
+ _context8.next = 10;
1004
1028
  break;
1005
1029
  }
1006
1030
  query.greaterThan('objectId', results[results.length - 1].id);
1007
1031
  previousResults = results;
1008
- _context10.next = 17;
1032
+ _context8.next = 17;
1009
1033
  break;
1010
1034
  case 10:
1011
1035
  if (!(results.length > 0)) {
1012
- _context10.next = 16;
1036
+ _context8.next = 16;
1013
1037
  break;
1014
1038
  }
1015
- _context10.next = 13;
1039
+ _context8.next = 13;
1016
1040
  return _promise.default.resolve(callback(results));
1017
1041
  case 13:
1018
1042
  finished = true;
1019
- _context10.next = 17;
1043
+ _context8.next = 17;
1020
1044
  break;
1021
1045
  case 16:
1022
1046
  finished = true;
1023
1047
  case 17:
1024
1048
  case "end":
1025
- return _context10.stop();
1049
+ return _context8.stop();
1026
1050
  }
1027
1051
  }, _callee3);
1028
1052
  })));
@@ -1123,12 +1147,12 @@ var ParseQuery = /*#__PURE__*/function () {
1123
1147
  var _map = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(callback /*: (currentObject: ParseObject, index: number, query: ParseQuery) => any*/, options /*:: ?: BatchOptions*/) {
1124
1148
  var _this5 = this;
1125
1149
  var array, index;
1126
- return _regenerator.default.wrap(function (_context11) {
1127
- while (1) switch (_context11.prev = _context11.next) {
1150
+ return _regenerator.default.wrap(function (_context9) {
1151
+ while (1) switch (_context9.prev = _context9.next) {
1128
1152
  case 0:
1129
1153
  array = [];
1130
1154
  index = 0;
1131
- _context11.next = 4;
1155
+ _context9.next = 4;
1132
1156
  return this.each(function (object) {
1133
1157
  return _promise.default.resolve(callback(object, index, _this5)).then(function (result) {
1134
1158
  array.push(result);
@@ -1136,10 +1160,10 @@ var ParseQuery = /*#__PURE__*/function () {
1136
1160
  });
1137
1161
  }, options);
1138
1162
  case 4:
1139
- return _context11.abrupt("return", array);
1163
+ return _context9.abrupt("return", array);
1140
1164
  case 5:
1141
1165
  case "end":
1142
- return _context11.stop();
1166
+ return _context9.stop();
1143
1167
  }
1144
1168
  }, _callee4, this);
1145
1169
  }));
@@ -1176,12 +1200,12 @@ var ParseQuery = /*#__PURE__*/function () {
1176
1200
  value: function () {
1177
1201
  var _reduce = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(callback /*: (accumulator: any, currentObject: ParseObject, index: number) => any*/, initialValue /*: any*/, options /*:: ?: BatchOptions*/) {
1178
1202
  var accumulator, index;
1179
- return _regenerator.default.wrap(function (_context12) {
1180
- while (1) switch (_context12.prev = _context12.next) {
1203
+ return _regenerator.default.wrap(function (_context10) {
1204
+ while (1) switch (_context10.prev = _context10.next) {
1181
1205
  case 0:
1182
1206
  accumulator = initialValue;
1183
1207
  index = 0;
1184
- _context12.next = 4;
1208
+ _context10.next = 4;
1185
1209
  return this.each(function (object) {
1186
1210
  // If no initial value was given, we take the first object from the query
1187
1211
  // as the initial value and don't call the callback with it.
@@ -1197,15 +1221,15 @@ var ParseQuery = /*#__PURE__*/function () {
1197
1221
  }, options);
1198
1222
  case 4:
1199
1223
  if (!(index === 0 && initialValue === undefined)) {
1200
- _context12.next = 6;
1224
+ _context10.next = 6;
1201
1225
  break;
1202
1226
  }
1203
1227
  throw new TypeError('Reducing empty query result set with no initial value');
1204
1228
  case 6:
1205
- return _context12.abrupt("return", accumulator);
1229
+ return _context10.abrupt("return", accumulator);
1206
1230
  case 7:
1207
1231
  case "end":
1208
- return _context12.stop();
1232
+ return _context10.stop();
1209
1233
  }
1210
1234
  }, _callee5, this);
1211
1235
  }));
@@ -1242,12 +1266,12 @@ var ParseQuery = /*#__PURE__*/function () {
1242
1266
  var _filter = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(callback /*: (currentObject: ParseObject, index: number, query: ParseQuery) => boolean*/, options /*:: ?: BatchOptions*/) {
1243
1267
  var _this6 = this;
1244
1268
  var array, index;
1245
- return _regenerator.default.wrap(function (_context13) {
1246
- while (1) switch (_context13.prev = _context13.next) {
1269
+ return _regenerator.default.wrap(function (_context11) {
1270
+ while (1) switch (_context11.prev = _context11.next) {
1247
1271
  case 0:
1248
1272
  array = [];
1249
1273
  index = 0;
1250
- _context13.next = 4;
1274
+ _context11.next = 4;
1251
1275
  return this.each(function (object) {
1252
1276
  return _promise.default.resolve(callback(object, index, _this6)).then(function (flag) {
1253
1277
  if (flag) {
@@ -1257,10 +1281,10 @@ var ParseQuery = /*#__PURE__*/function () {
1257
1281
  });
1258
1282
  }, options);
1259
1283
  case 4:
1260
- return _context13.abrupt("return", array);
1284
+ return _context11.abrupt("return", array);
1261
1285
  case 5:
1262
1286
  case "end":
1263
- return _context13.stop();
1287
+ return _context11.stop();
1264
1288
  }
1265
1289
  }, _callee6, this);
1266
1290
  }));
@@ -1283,8 +1307,8 @@ var ParseQuery = /*#__PURE__*/function () {
1283
1307
  value: function (key /*: string | { [key: string]: any }*/, value /*: ?mixed*/) /*: ParseQuery*/{
1284
1308
  var _this7 = this;
1285
1309
  if (key && (0, _typeof2.default)(key) === 'object') {
1286
- var _context14;
1287
- (0, _forEach.default)(_context14 = (0, _entries.default)(key)).call(_context14, function (_ref2) {
1310
+ var _context12;
1311
+ (0, _forEach.default)(_context12 = (0, _entries.default)(key)).call(_context12, function (_ref2) {
1288
1312
  var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
1289
1313
  k = _ref3[0],
1290
1314
  val = _ref3[1];
@@ -1312,8 +1336,8 @@ var ParseQuery = /*#__PURE__*/function () {
1312
1336
  value: function (key /*: string | { [key: string]: any }*/, value /*: ?mixed*/) /*: ParseQuery*/{
1313
1337
  var _this8 = this;
1314
1338
  if (key && (0, _typeof2.default)(key) === 'object') {
1315
- var _context15;
1316
- (0, _forEach.default)(_context15 = (0, _entries.default)(key)).call(_context15, function (_ref4) {
1339
+ var _context13;
1340
+ (0, _forEach.default)(_context13 = (0, _entries.default)(key)).call(_context13, function (_ref4) {
1317
1341
  var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
1318
1342
  k = _ref5[0],
1319
1343
  val = _ref5[1];
@@ -1902,11 +1926,11 @@ var ParseQuery = /*#__PURE__*/function () {
1902
1926
  keys[_key6] = arguments[_key6];
1903
1927
  }
1904
1928
  (0, _forEach.default)(keys).call(keys, function (key) {
1905
- var _context16;
1929
+ var _context14;
1906
1930
  if ((0, _isArray.default)(key)) {
1907
1931
  key = key.join();
1908
1932
  }
1909
- _this9._order = (0, _concat.default)(_context16 = _this9._order).call(_context16, key.replace(/\s/g, '').split(','));
1933
+ _this9._order = (0, _concat.default)(_context14 = _this9._order).call(_context14, key.replace(/\s/g, '').split(','));
1910
1934
  });
1911
1935
  return this;
1912
1936
  }
@@ -1947,11 +1971,11 @@ var ParseQuery = /*#__PURE__*/function () {
1947
1971
  keys[_key8] = arguments[_key8];
1948
1972
  }
1949
1973
  (0, _forEach.default)(keys).call(keys, function (key) {
1950
- var _context17, _context18;
1974
+ var _context15, _context16;
1951
1975
  if ((0, _isArray.default)(key)) {
1952
1976
  key = key.join();
1953
1977
  }
1954
- _this10._order = (0, _concat.default)(_context17 = _this10._order).call(_context17, (0, _map2.default)(_context18 = key.replace(/\s/g, '').split(',')).call(_context18, function (k) {
1978
+ _this10._order = (0, _concat.default)(_context15 = _this10._order).call(_context15, (0, _map2.default)(_context16 = key.replace(/\s/g, '').split(',')).call(_context16, function (k) {
1955
1979
  return '-' + k;
1956
1980
  }));
1957
1981
  });
@@ -2033,8 +2057,8 @@ var ParseQuery = /*#__PURE__*/function () {
2033
2057
  }
2034
2058
  (0, _forEach.default)(keys).call(keys, function (key) {
2035
2059
  if ((0, _isArray.default)(key)) {
2036
- var _context19;
2037
- _this11._include = (0, _concat.default)(_context19 = _this11._include).call(_context19, key);
2060
+ var _context17;
2061
+ _this11._include = (0, _concat.default)(_context17 = _this11._include).call(_context17, key);
2038
2062
  } else {
2039
2063
  _this11._include.push(key);
2040
2064
  }
@@ -2075,8 +2099,8 @@ var ParseQuery = /*#__PURE__*/function () {
2075
2099
  }
2076
2100
  (0, _forEach.default)(keys).call(keys, function (key) {
2077
2101
  if ((0, _isArray.default)(key)) {
2078
- var _context20;
2079
- _this12._select = (0, _concat.default)(_context20 = _this12._select).call(_context20, key);
2102
+ var _context18;
2103
+ _this12._select = (0, _concat.default)(_context18 = _this12._select).call(_context18, key);
2080
2104
  } else {
2081
2105
  _this12._select.push(key);
2082
2106
  }
@@ -2102,8 +2126,8 @@ var ParseQuery = /*#__PURE__*/function () {
2102
2126
  }
2103
2127
  (0, _forEach.default)(keys).call(keys, function (key) {
2104
2128
  if ((0, _isArray.default)(key)) {
2105
- var _context21;
2106
- _this13._exclude = (0, _concat.default)(_context21 = _this13._exclude).call(_context21, key);
2129
+ var _context19;
2130
+ _this13._exclude = (0, _concat.default)(_context19 = _this13._exclude).call(_context19, key);
2107
2131
  } else {
2108
2132
  _this13._exclude.push(key);
2109
2133
  }
@@ -2111,6 +2135,32 @@ var ParseQuery = /*#__PURE__*/function () {
2111
2135
  return this;
2112
2136
  }
2113
2137
 
2138
+ /**
2139
+ * Restricts live query to trigger only for watched fields.
2140
+ *
2141
+ * Requires Parse Server 6.0.0+
2142
+ *
2143
+ * @param {...string|Array<string>} keys The name(s) of the key(s) to watch.
2144
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
2145
+ */
2146
+ }, {
2147
+ key: "watch",
2148
+ value: function () /*: ParseQuery*/{
2149
+ var _this14 = this;
2150
+ for (var _len8 = arguments.length, keys = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
2151
+ keys[_key12] = arguments[_key12];
2152
+ }
2153
+ (0, _forEach.default)(keys).call(keys, function (key) {
2154
+ if ((0, _isArray.default)(key)) {
2155
+ var _context20;
2156
+ _this14._watch = (0, _concat.default)(_context20 = _this14._watch).call(_context20, key);
2157
+ } else {
2158
+ _this14._watch.push(key);
2159
+ }
2160
+ });
2161
+ return this;
2162
+ }
2163
+
2114
2164
  /**
2115
2165
  * Changes the read preference that the backend will use when performing the query to the database.
2116
2166
  *
@@ -2140,30 +2190,30 @@ var ParseQuery = /*#__PURE__*/function () {
2140
2190
  value: function () {
2141
2191
  var _subscribe = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(sessionToken /*:: ?: string*/) {
2142
2192
  var currentUser, liveQueryClient, subscription;
2143
- return _regenerator.default.wrap(function (_context22) {
2144
- while (1) switch (_context22.prev = _context22.next) {
2193
+ return _regenerator.default.wrap(function (_context21) {
2194
+ while (1) switch (_context21.prev = _context21.next) {
2145
2195
  case 0:
2146
- _context22.next = 2;
2196
+ _context21.next = 2;
2147
2197
  return _CoreManager.default.getUserController().currentUserAsync();
2148
2198
  case 2:
2149
- currentUser = _context22.sent;
2199
+ currentUser = _context21.sent;
2150
2200
  if (!sessionToken) {
2151
2201
  sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
2152
2202
  }
2153
- _context22.next = 6;
2203
+ _context21.next = 6;
2154
2204
  return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
2155
2205
  case 6:
2156
- liveQueryClient = _context22.sent;
2206
+ liveQueryClient = _context21.sent;
2157
2207
  if (liveQueryClient.shouldOpen()) {
2158
2208
  liveQueryClient.open();
2159
2209
  }
2160
2210
  subscription = liveQueryClient.subscribe(this, sessionToken);
2161
- return _context22.abrupt("return", subscription.subscribePromise.then(function () {
2211
+ return _context21.abrupt("return", subscription.subscribePromise.then(function () {
2162
2212
  return subscription;
2163
2213
  }));
2164
2214
  case 10:
2165
2215
  case "end":
2166
- return _context22.stop();
2216
+ return _context21.stop();
2167
2217
  }
2168
2218
  }, _callee7, this);
2169
2219
  }));
@@ -2245,7 +2295,7 @@ var ParseQuery = /*#__PURE__*/function () {
2245
2295
  }, {
2246
2296
  key: "cancel",
2247
2297
  value: function () /*: ParseQuery*/{
2248
- var _this14 = this;
2298
+ var _this15 = this;
2249
2299
  if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {
2250
2300
  this._xhrRequest.task._aborted = true;
2251
2301
  this._xhrRequest.task.abort();
@@ -2254,16 +2304,16 @@ var ParseQuery = /*#__PURE__*/function () {
2254
2304
  return this;
2255
2305
  }
2256
2306
  return this._xhrRequest.onchange = function () {
2257
- return _this14.cancel();
2307
+ return _this15.cancel();
2258
2308
  };
2259
2309
  }
2260
2310
  }, {
2261
2311
  key: "_setRequestTask",
2262
2312
  value: function (options) {
2263
- var _this15 = this;
2313
+ var _this16 = this;
2264
2314
  options.requestTask = function (task) {
2265
- _this15._xhrRequest.task = task;
2266
- _this15._xhrRequest.onchange();
2315
+ _this16._xhrRequest.task = task;
2316
+ _this16._xhrRequest.onchange();
2267
2317
  };
2268
2318
  }
2269
2319
  }], [{
@@ -2275,8 +2325,8 @@ var ParseQuery = /*#__PURE__*/function () {
2275
2325
  }, {
2276
2326
  key: "or",
2277
2327
  value: function () /*: ParseQuery*/{
2278
- for (var _len8 = arguments.length, queries = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
2279
- queries[_key12] = arguments[_key12];
2328
+ for (var _len9 = arguments.length, queries = new Array(_len9), _key13 = 0; _key13 < _len9; _key13++) {
2329
+ queries[_key13] = arguments[_key13];
2280
2330
  }
2281
2331
  var className = _getClassNameFromQueries(queries);
2282
2332
  var query = new ParseQuery(className);
@@ -2299,8 +2349,8 @@ var ParseQuery = /*#__PURE__*/function () {
2299
2349
  }, {
2300
2350
  key: "and",
2301
2351
  value: function () /*: ParseQuery*/{
2302
- for (var _len9 = arguments.length, queries = new Array(_len9), _key13 = 0; _key13 < _len9; _key13++) {
2303
- queries[_key13] = arguments[_key13];
2352
+ for (var _len10 = arguments.length, queries = new Array(_len10), _key14 = 0; _key14 < _len10; _key14++) {
2353
+ queries[_key14] = arguments[_key14];
2304
2354
  }
2305
2355
  var className = _getClassNameFromQueries(queries);
2306
2356
  var query = new ParseQuery(className);
@@ -2323,8 +2373,8 @@ var ParseQuery = /*#__PURE__*/function () {
2323
2373
  }, {
2324
2374
  key: "nor",
2325
2375
  value: function () /*: ParseQuery*/{
2326
- for (var _len10 = arguments.length, queries = new Array(_len10), _key14 = 0; _key14 < _len10; _key14++) {
2327
- queries[_key14] = arguments[_key14];
2376
+ for (var _len11 = arguments.length, queries = new Array(_len11), _key15 = 0; _key15 < _len11; _key15++) {
2377
+ queries[_key15] = arguments[_key15];
2328
2378
  }
2329
2379
  var className = _getClassNameFromQueries(queries);
2330
2380
  var query = new ParseQuery(className);
@@ -40,7 +40,11 @@ function _isNativeReflectConstruct() {
40
40
  } catch (e) {
41
41
  return false;
42
42
  }
43
- }
43
+ } /**
44
+ * @flow
45
+ */
46
+ /*:: import type { AttributeMap } from './ObjectStateMutations';*/
47
+ /*:: import type ParseRelation from './ParseRelation';*/
44
48
  /**
45
49
  * Represents a Role on the Parse server. Roles represent groupings of
46
50
  * Users for the purposes of granting permissions (e.g. specifying an ACL
@@ -16,8 +16,8 @@ var _ParseCLP = _interopRequireDefault(require("./ParseCLP"));
16
16
  /**
17
17
  * @flow
18
18
  */
19
-
20
- var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
19
+ /*:: import type { PermissionsMap } from './ParseCLP';*/
20
+ var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Bytes', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
21
21
  /*:: type FieldOptions = {
22
22
  required: boolean,
23
23
  defaultValue: mixed,
@@ -236,6 +236,14 @@ var ParseSchema = /*#__PURE__*/function () {
236
236
  };
237
237
  }
238
238
  }
239
+ if (type === 'Bytes') {
240
+ if (options && options.defaultValue) {
241
+ fieldOptions.defaultValue = {
242
+ __type: 'Bytes',
243
+ base64: options.defaultValue
244
+ };
245
+ }
246
+ }
239
247
  this._fields[name] = fieldOptions;
240
248
  return this;
241
249
  }
@@ -303,6 +311,19 @@ var ParseSchema = /*#__PURE__*/function () {
303
311
  return this.addField(name, 'Boolean', options);
304
312
  }
305
313
 
314
+ /**
315
+ * Adding Bytes Field
316
+ *
317
+ * @param {string} name Name of the field that will be created on Parse
318
+ * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
319
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
320
+ */
321
+ }, {
322
+ key: "addBytes",
323
+ value: function (name /*: string*/, options /*: FieldOptions*/) {
324
+ return this.addField(name, 'Bytes', options);
325
+ }
326
+
306
327
  /**
307
328
  * Adding Date Field
308
329
  *
@@ -57,7 +57,7 @@ var ParseSession = /*#__PURE__*/function (_ParseObject) {
57
57
  /**
58
58
  * @param {object} attributes The initial set of data to store in the user.
59
59
  */
60
- function ParseSession(attributes /*: ?AttributeMap*/) {
60
+ function ParseSession(attributes /*:: ?: any*/) {
61
61
  var _this;
62
62
  (0, _classCallCheck2.default)(this, ParseSession);
63
63
  _this = _super.call(this, '_Session');