parse 4.2.0-alpha.9 → 4.2.0

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 (60) hide show
  1. package/dist/parse.js +1312 -1712
  2. package/dist/parse.min.js +2 -2
  3. package/dist/parse.weapp.js +1294 -1694
  4. package/dist/parse.weapp.min.js +2 -2
  5. package/lib/browser/Cloud.js +0 -3
  6. package/lib/browser/CoreManager.js +4 -13
  7. package/lib/browser/EventuallyQueue.js +3 -11
  8. package/lib/browser/LocalDatastore.js +0 -7
  9. package/lib/browser/ObjectStateMutations.js +1 -3
  10. package/lib/browser/OfflineQuery.js +1 -1
  11. package/lib/browser/Parse.js +135 -167
  12. package/lib/browser/ParseError.js +1 -12
  13. package/lib/browser/ParseObject.js +1 -1
  14. package/lib/browser/ParseQuery.js +58 -53
  15. package/lib/browser/ParseSchema.js +1 -22
  16. package/lib/browser/ParseSession.js +6 -2
  17. package/lib/browser/ParseUser.js +8 -65
  18. package/lib/browser/Storage.js +0 -7
  19. package/lib/node/Cloud.js +0 -3
  20. package/lib/node/CoreManager.js +4 -12
  21. package/lib/node/EventuallyQueue.js +3 -10
  22. package/lib/node/LocalDatastore.js +0 -6
  23. package/lib/node/ObjectStateMutations.js +1 -3
  24. package/lib/node/OfflineQuery.js +1 -1
  25. package/lib/node/Parse.js +126 -158
  26. package/lib/node/ParseError.js +1 -15
  27. package/lib/node/ParseObject.js +1 -1
  28. package/lib/node/ParseQuery.js +6 -3
  29. package/lib/node/ParseSchema.js +1 -20
  30. package/lib/node/ParseSession.js +6 -1
  31. package/lib/node/ParseUser.js +8 -58
  32. package/lib/node/Storage.js +0 -6
  33. package/lib/react-native/Cloud.js +0 -3
  34. package/lib/react-native/CoreManager.js +4 -12
  35. package/lib/react-native/EventEmitter.js +1 -1
  36. package/lib/react-native/EventuallyQueue.js +3 -10
  37. package/lib/react-native/LocalDatastore.js +0 -6
  38. package/lib/react-native/ObjectStateMutations.js +1 -3
  39. package/lib/react-native/OfflineQuery.js +1 -1
  40. package/lib/react-native/Parse.js +90 -123
  41. package/lib/react-native/ParseError.js +1 -8
  42. package/lib/react-native/ParseQuery.js +6 -3
  43. package/lib/react-native/ParseSchema.js +1 -14
  44. package/lib/react-native/ParseUser.js +6 -49
  45. package/lib/react-native/Storage.js +0 -6
  46. package/lib/weapp/Cloud.js +0 -3
  47. package/lib/weapp/CoreManager.js +4 -13
  48. package/lib/weapp/EventuallyQueue.js +3 -11
  49. package/lib/weapp/LocalDatastore.js +0 -7
  50. package/lib/weapp/ObjectStateMutations.js +1 -3
  51. package/lib/weapp/OfflineQuery.js +1 -1
  52. package/lib/weapp/Parse.js +134 -166
  53. package/lib/weapp/ParseError.js +1 -12
  54. package/lib/weapp/ParseObject.js +1 -1
  55. package/lib/weapp/ParseQuery.js +58 -53
  56. package/lib/weapp/ParseSchema.js +1 -22
  57. package/lib/weapp/ParseSession.js +6 -2
  58. package/lib/weapp/ParseUser.js +8 -65
  59. package/lib/weapp/Storage.js +0 -7
  60. package/package.json +17 -21
@@ -965,16 +965,21 @@ var ParseQuery = /*#__PURE__*/function () {
965
965
  }, {
966
966
  key: "eachBatch",
967
967
  value: function (callback /*: (objs: Array<ParseObject>) => Promise<*>*/, options /*:: ?: BatchOptions*/) /*: Promise<void>*/{
968
+ var _context8;
968
969
  options = options || {};
969
970
  if (this._order || this._skip || this._limit >= 0) {
970
971
  return _promise.default.reject('Cannot iterate on a query with sort, skip, or limit.');
971
972
  }
972
973
  var query = new ParseQuery(this.className);
973
974
  query._limit = options.batchSize || 100;
974
- query._include = (0, _toConsumableArray2.default)(this._include);
975
- query._exclude = (0, _toConsumableArray2.default)(this._exclude);
975
+ query._include = (0, _map2.default)(_context8 = this._include).call(_context8, function (i) {
976
+ return i;
977
+ });
976
978
  if (this._select) {
977
- query._select = (0, _toConsumableArray2.default)(this._select);
979
+ var _context9;
980
+ query._select = (0, _map2.default)(_context9 = this._select).call(_context9, function (s) {
981
+ return s;
982
+ });
978
983
  }
979
984
  query._hint = this._hint;
980
985
  query._where = {};
@@ -1014,39 +1019,39 @@ var ParseQuery = /*#__PURE__*/function () {
1014
1019
  return !finished;
1015
1020
  }, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
1016
1021
  var _yield$Promise$all, _yield$Promise$all2, results;
1017
- return _regenerator.default.wrap(function (_context8) {
1018
- while (1) switch (_context8.prev = _context8.next) {
1022
+ return _regenerator.default.wrap(function (_context10) {
1023
+ while (1) switch (_context10.prev = _context10.next) {
1019
1024
  case 0:
1020
- _context8.next = 2;
1025
+ _context10.next = 2;
1021
1026
  return _promise.default.all([(0, _find.default)(query).call(query, findOptions), _promise.default.resolve(previousResults.length > 0 && callback(previousResults))]);
1022
1027
  case 2:
1023
- _yield$Promise$all = _context8.sent;
1028
+ _yield$Promise$all = _context10.sent;
1024
1029
  _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 1);
1025
1030
  results = _yield$Promise$all2[0];
1026
1031
  if (!(results.length >= query._limit)) {
1027
- _context8.next = 10;
1032
+ _context10.next = 10;
1028
1033
  break;
1029
1034
  }
1030
1035
  query.greaterThan('objectId', results[results.length - 1].id);
1031
1036
  previousResults = results;
1032
- _context8.next = 17;
1037
+ _context10.next = 17;
1033
1038
  break;
1034
1039
  case 10:
1035
1040
  if (!(results.length > 0)) {
1036
- _context8.next = 16;
1041
+ _context10.next = 16;
1037
1042
  break;
1038
1043
  }
1039
- _context8.next = 13;
1044
+ _context10.next = 13;
1040
1045
  return _promise.default.resolve(callback(results));
1041
1046
  case 13:
1042
1047
  finished = true;
1043
- _context8.next = 17;
1048
+ _context10.next = 17;
1044
1049
  break;
1045
1050
  case 16:
1046
1051
  finished = true;
1047
1052
  case 17:
1048
1053
  case "end":
1049
- return _context8.stop();
1054
+ return _context10.stop();
1050
1055
  }
1051
1056
  }, _callee3);
1052
1057
  })));
@@ -1147,12 +1152,12 @@ var ParseQuery = /*#__PURE__*/function () {
1147
1152
  var _map = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(callback /*: (currentObject: ParseObject, index: number, query: ParseQuery) => any*/, options /*:: ?: BatchOptions*/) {
1148
1153
  var _this5 = this;
1149
1154
  var array, index;
1150
- return _regenerator.default.wrap(function (_context9) {
1151
- while (1) switch (_context9.prev = _context9.next) {
1155
+ return _regenerator.default.wrap(function (_context11) {
1156
+ while (1) switch (_context11.prev = _context11.next) {
1152
1157
  case 0:
1153
1158
  array = [];
1154
1159
  index = 0;
1155
- _context9.next = 4;
1160
+ _context11.next = 4;
1156
1161
  return this.each(function (object) {
1157
1162
  return _promise.default.resolve(callback(object, index, _this5)).then(function (result) {
1158
1163
  array.push(result);
@@ -1160,10 +1165,10 @@ var ParseQuery = /*#__PURE__*/function () {
1160
1165
  });
1161
1166
  }, options);
1162
1167
  case 4:
1163
- return _context9.abrupt("return", array);
1168
+ return _context11.abrupt("return", array);
1164
1169
  case 5:
1165
1170
  case "end":
1166
- return _context9.stop();
1171
+ return _context11.stop();
1167
1172
  }
1168
1173
  }, _callee4, this);
1169
1174
  }));
@@ -1200,12 +1205,12 @@ var ParseQuery = /*#__PURE__*/function () {
1200
1205
  value: function () {
1201
1206
  var _reduce = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(callback /*: (accumulator: any, currentObject: ParseObject, index: number) => any*/, initialValue /*: any*/, options /*:: ?: BatchOptions*/) {
1202
1207
  var accumulator, index;
1203
- return _regenerator.default.wrap(function (_context10) {
1204
- while (1) switch (_context10.prev = _context10.next) {
1208
+ return _regenerator.default.wrap(function (_context12) {
1209
+ while (1) switch (_context12.prev = _context12.next) {
1205
1210
  case 0:
1206
1211
  accumulator = initialValue;
1207
1212
  index = 0;
1208
- _context10.next = 4;
1213
+ _context12.next = 4;
1209
1214
  return this.each(function (object) {
1210
1215
  // If no initial value was given, we take the first object from the query
1211
1216
  // as the initial value and don't call the callback with it.
@@ -1221,15 +1226,15 @@ var ParseQuery = /*#__PURE__*/function () {
1221
1226
  }, options);
1222
1227
  case 4:
1223
1228
  if (!(index === 0 && initialValue === undefined)) {
1224
- _context10.next = 6;
1229
+ _context12.next = 6;
1225
1230
  break;
1226
1231
  }
1227
1232
  throw new TypeError('Reducing empty query result set with no initial value');
1228
1233
  case 6:
1229
- return _context10.abrupt("return", accumulator);
1234
+ return _context12.abrupt("return", accumulator);
1230
1235
  case 7:
1231
1236
  case "end":
1232
- return _context10.stop();
1237
+ return _context12.stop();
1233
1238
  }
1234
1239
  }, _callee5, this);
1235
1240
  }));
@@ -1266,12 +1271,12 @@ var ParseQuery = /*#__PURE__*/function () {
1266
1271
  var _filter = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(callback /*: (currentObject: ParseObject, index: number, query: ParseQuery) => boolean*/, options /*:: ?: BatchOptions*/) {
1267
1272
  var _this6 = this;
1268
1273
  var array, index;
1269
- return _regenerator.default.wrap(function (_context11) {
1270
- while (1) switch (_context11.prev = _context11.next) {
1274
+ return _regenerator.default.wrap(function (_context13) {
1275
+ while (1) switch (_context13.prev = _context13.next) {
1271
1276
  case 0:
1272
1277
  array = [];
1273
1278
  index = 0;
1274
- _context11.next = 4;
1279
+ _context13.next = 4;
1275
1280
  return this.each(function (object) {
1276
1281
  return _promise.default.resolve(callback(object, index, _this6)).then(function (flag) {
1277
1282
  if (flag) {
@@ -1281,10 +1286,10 @@ var ParseQuery = /*#__PURE__*/function () {
1281
1286
  });
1282
1287
  }, options);
1283
1288
  case 4:
1284
- return _context11.abrupt("return", array);
1289
+ return _context13.abrupt("return", array);
1285
1290
  case 5:
1286
1291
  case "end":
1287
- return _context11.stop();
1292
+ return _context13.stop();
1288
1293
  }
1289
1294
  }, _callee6, this);
1290
1295
  }));
@@ -1307,8 +1312,8 @@ var ParseQuery = /*#__PURE__*/function () {
1307
1312
  value: function (key /*: string | { [key: string]: any }*/, value /*: ?mixed*/) /*: ParseQuery*/{
1308
1313
  var _this7 = this;
1309
1314
  if (key && (0, _typeof2.default)(key) === 'object') {
1310
- var _context12;
1311
- (0, _forEach.default)(_context12 = (0, _entries.default)(key)).call(_context12, function (_ref2) {
1315
+ var _context14;
1316
+ (0, _forEach.default)(_context14 = (0, _entries.default)(key)).call(_context14, function (_ref2) {
1312
1317
  var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
1313
1318
  k = _ref3[0],
1314
1319
  val = _ref3[1];
@@ -1336,8 +1341,8 @@ var ParseQuery = /*#__PURE__*/function () {
1336
1341
  value: function (key /*: string | { [key: string]: any }*/, value /*: ?mixed*/) /*: ParseQuery*/{
1337
1342
  var _this8 = this;
1338
1343
  if (key && (0, _typeof2.default)(key) === 'object') {
1339
- var _context13;
1340
- (0, _forEach.default)(_context13 = (0, _entries.default)(key)).call(_context13, function (_ref4) {
1344
+ var _context15;
1345
+ (0, _forEach.default)(_context15 = (0, _entries.default)(key)).call(_context15, function (_ref4) {
1341
1346
  var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
1342
1347
  k = _ref5[0],
1343
1348
  val = _ref5[1];
@@ -1926,11 +1931,11 @@ var ParseQuery = /*#__PURE__*/function () {
1926
1931
  keys[_key6] = arguments[_key6];
1927
1932
  }
1928
1933
  (0, _forEach.default)(keys).call(keys, function (key) {
1929
- var _context14;
1934
+ var _context16;
1930
1935
  if ((0, _isArray.default)(key)) {
1931
1936
  key = key.join();
1932
1937
  }
1933
- _this9._order = (0, _concat.default)(_context14 = _this9._order).call(_context14, key.replace(/\s/g, '').split(','));
1938
+ _this9._order = (0, _concat.default)(_context16 = _this9._order).call(_context16, key.replace(/\s/g, '').split(','));
1934
1939
  });
1935
1940
  return this;
1936
1941
  }
@@ -1971,11 +1976,11 @@ var ParseQuery = /*#__PURE__*/function () {
1971
1976
  keys[_key8] = arguments[_key8];
1972
1977
  }
1973
1978
  (0, _forEach.default)(keys).call(keys, function (key) {
1974
- var _context15, _context16;
1979
+ var _context17, _context18;
1975
1980
  if ((0, _isArray.default)(key)) {
1976
1981
  key = key.join();
1977
1982
  }
1978
- _this10._order = (0, _concat.default)(_context15 = _this10._order).call(_context15, (0, _map2.default)(_context16 = key.replace(/\s/g, '').split(',')).call(_context16, function (k) {
1983
+ _this10._order = (0, _concat.default)(_context17 = _this10._order).call(_context17, (0, _map2.default)(_context18 = key.replace(/\s/g, '').split(',')).call(_context18, function (k) {
1979
1984
  return '-' + k;
1980
1985
  }));
1981
1986
  });
@@ -2057,8 +2062,8 @@ var ParseQuery = /*#__PURE__*/function () {
2057
2062
  }
2058
2063
  (0, _forEach.default)(keys).call(keys, function (key) {
2059
2064
  if ((0, _isArray.default)(key)) {
2060
- var _context17;
2061
- _this11._include = (0, _concat.default)(_context17 = _this11._include).call(_context17, key);
2065
+ var _context19;
2066
+ _this11._include = (0, _concat.default)(_context19 = _this11._include).call(_context19, key);
2062
2067
  } else {
2063
2068
  _this11._include.push(key);
2064
2069
  }
@@ -2099,8 +2104,8 @@ var ParseQuery = /*#__PURE__*/function () {
2099
2104
  }
2100
2105
  (0, _forEach.default)(keys).call(keys, function (key) {
2101
2106
  if ((0, _isArray.default)(key)) {
2102
- var _context18;
2103
- _this12._select = (0, _concat.default)(_context18 = _this12._select).call(_context18, key);
2107
+ var _context20;
2108
+ _this12._select = (0, _concat.default)(_context20 = _this12._select).call(_context20, key);
2104
2109
  } else {
2105
2110
  _this12._select.push(key);
2106
2111
  }
@@ -2126,8 +2131,8 @@ var ParseQuery = /*#__PURE__*/function () {
2126
2131
  }
2127
2132
  (0, _forEach.default)(keys).call(keys, function (key) {
2128
2133
  if ((0, _isArray.default)(key)) {
2129
- var _context19;
2130
- _this13._exclude = (0, _concat.default)(_context19 = _this13._exclude).call(_context19, key);
2134
+ var _context21;
2135
+ _this13._exclude = (0, _concat.default)(_context21 = _this13._exclude).call(_context21, key);
2131
2136
  } else {
2132
2137
  _this13._exclude.push(key);
2133
2138
  }
@@ -2152,8 +2157,8 @@ var ParseQuery = /*#__PURE__*/function () {
2152
2157
  }
2153
2158
  (0, _forEach.default)(keys).call(keys, function (key) {
2154
2159
  if ((0, _isArray.default)(key)) {
2155
- var _context20;
2156
- _this14._watch = (0, _concat.default)(_context20 = _this14._watch).call(_context20, key);
2160
+ var _context22;
2161
+ _this14._watch = (0, _concat.default)(_context22 = _this14._watch).call(_context22, key);
2157
2162
  } else {
2158
2163
  _this14._watch.push(key);
2159
2164
  }
@@ -2190,30 +2195,30 @@ var ParseQuery = /*#__PURE__*/function () {
2190
2195
  value: function () {
2191
2196
  var _subscribe = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(sessionToken /*:: ?: string*/) {
2192
2197
  var currentUser, liveQueryClient, subscription;
2193
- return _regenerator.default.wrap(function (_context21) {
2194
- while (1) switch (_context21.prev = _context21.next) {
2198
+ return _regenerator.default.wrap(function (_context23) {
2199
+ while (1) switch (_context23.prev = _context23.next) {
2195
2200
  case 0:
2196
- _context21.next = 2;
2201
+ _context23.next = 2;
2197
2202
  return _CoreManager.default.getUserController().currentUserAsync();
2198
2203
  case 2:
2199
- currentUser = _context21.sent;
2204
+ currentUser = _context23.sent;
2200
2205
  if (!sessionToken) {
2201
2206
  sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
2202
2207
  }
2203
- _context21.next = 6;
2208
+ _context23.next = 6;
2204
2209
  return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
2205
2210
  case 6:
2206
- liveQueryClient = _context21.sent;
2211
+ liveQueryClient = _context23.sent;
2207
2212
  if (liveQueryClient.shouldOpen()) {
2208
2213
  liveQueryClient.open();
2209
2214
  }
2210
2215
  subscription = liveQueryClient.subscribe(this, sessionToken);
2211
- return _context21.abrupt("return", subscription.subscribePromise.then(function () {
2216
+ return _context23.abrupt("return", subscription.subscribePromise.then(function () {
2212
2217
  return subscription;
2213
2218
  }));
2214
2219
  case 10:
2215
2220
  case "end":
2216
- return _context21.stop();
2221
+ return _context23.stop();
2217
2222
  }
2218
2223
  }, _callee7, this);
2219
2224
  }));
@@ -17,7 +17,7 @@ var _ParseCLP = _interopRequireDefault(require("./ParseCLP"));
17
17
  * @flow
18
18
  */
19
19
  /*:: import type { PermissionsMap } from './ParseCLP';*/
20
- var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Bytes', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
20
+ var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
21
21
  /*:: type FieldOptions = {
22
22
  required: boolean,
23
23
  defaultValue: mixed,
@@ -236,14 +236,6 @@ 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
- }
247
239
  this._fields[name] = fieldOptions;
248
240
  return this;
249
241
  }
@@ -311,19 +303,6 @@ var ParseSchema = /*#__PURE__*/function () {
311
303
  return this.addField(name, 'Boolean', options);
312
304
  }
313
305
 
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
-
327
306
  /**
328
307
  * Adding Date Field
329
308
  *
@@ -42,7 +42,11 @@ function _isNativeReflectConstruct() {
42
42
  } catch (e) {
43
43
  return false;
44
44
  }
45
- }
45
+ } /**
46
+ * @flow
47
+ */
48
+ /*:: import type { AttributeMap } from './ObjectStateMutations';*/
49
+ /*:: import type { RequestOptions, FullOptions } from './RESTController';*/
46
50
  /**
47
51
  * <p>A Parse.Session object is a local representation of a revocable session.
48
52
  * This class is a subclass of a Parse.Object, and retains the same
@@ -57,7 +61,7 @@ var ParseSession = /*#__PURE__*/function (_ParseObject) {
57
61
  /**
58
62
  * @param {object} attributes The initial set of data to store in the user.
59
63
  */
60
- function ParseSession(attributes /*:: ?: any*/) {
64
+ function ParseSession(attributes /*: ?AttributeMap*/) {
61
65
  var _this;
62
66
  (0, _classCallCheck2.default)(this, ParseSession);
63
67
  _this = _super.call(this, '_Session');
@@ -155,14 +155,8 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
155
155
  throw new Error('Invalid type: authData field should be an object');
156
156
  }
157
157
  authData[authType] = options.authData;
158
- var oldAnonymousData = authData.anonymous;
159
- this.stripAnonymity();
160
158
  var controller = _CoreManager.default.getUserController();
161
- return controller.linkWith(this, authData, saveOpts).catch(function (e) {
162
- delete authData[authType];
163
- _this2.restoreAnonimity(oldAnonymousData);
164
- throw e;
165
- });
159
+ return controller.linkWith(this, authData, saveOpts);
166
160
  } else {
167
161
  return new _promise.default(function (resolve, reject) {
168
162
  provider.authenticate({
@@ -393,24 +387,6 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
393
387
  }
394
388
  return isCurrentAsync;
395
389
  }()
396
- }, {
397
- key: "stripAnonymity",
398
- value: function () {
399
- var authData = this.get('authData');
400
- if (authData && (0, _typeof2.default)(authData) === 'object' && authData.hasOwnProperty('anonymous')) {
401
- // We need to set anonymous to null instead of deleting it in order to remove it from Parse.
402
- authData.anonymous = null;
403
- }
404
- }
405
- }, {
406
- key: "restoreAnonimity",
407
- value: function (anonymousData /*: any*/) {
408
- if (anonymousData) {
409
- var authData = this.get('authData');
410
- authData.anonymous = anonymousData;
411
- }
412
- }
413
-
414
390
  /**
415
391
  * Returns get("username").
416
392
  *
@@ -434,7 +410,12 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
434
410
  }, {
435
411
  key: "setUsername",
436
412
  value: function (username /*: string*/) {
437
- this.stripAnonymity();
413
+ // Strip anonymity
414
+ var authData = this.get('authData');
415
+ if (authData && (0, _typeof2.default)(authData) === 'object' && authData.hasOwnProperty('anonymous')) {
416
+ // We need to set anonymous to null instead of deleting it in order to remove it from Parse.
417
+ authData.anonymous = null;
418
+ }
438
419
  this.set('username', username);
439
420
  }
440
421
 
@@ -563,9 +544,6 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
563
544
  if (options.hasOwnProperty('usePost')) {
564
545
  loginOptions.usePost = options.usePost;
565
546
  }
566
- if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
567
- loginOptions.context = options.context;
568
- }
569
547
  var controller = _CoreManager.default.getUserController();
570
548
  return controller.logIn(this, loginOptions);
571
549
  }
@@ -902,40 +880,6 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
902
880
  return user.logIn(options);
903
881
  }
904
882
 
905
- /**
906
- * Logs in a user with a username (or email) and password, and authData. On success, this
907
- * saves the session to disk, so you can retrieve the currently logged in
908
- * user using <code>current</code>.
909
- *
910
- * @param {string} username The username (or email) to log in with.
911
- * @param {string} password The password to log in with.
912
- * @param {object} authData The authData to log in with.
913
- * @param {object} options
914
- * @static
915
- * @returns {Promise} A promise that is fulfilled with the user when
916
- * the login completes.
917
- */
918
- }, {
919
- key: "logInWithAdditionalAuth",
920
- value: function (username /*: string*/, password /*: string*/, authData /*: AuthData*/, options /*:: ?: FullOptions*/) {
921
- if (typeof username !== 'string') {
922
- return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Username must be a string.'));
923
- }
924
- if (typeof password !== 'string') {
925
- return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
926
- }
927
- if (Object.prototype.toString.call(authData) !== '[object Object]') {
928
- return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Auth must be an object.'));
929
- }
930
- var user = new this();
931
- user._finishFetch({
932
- username: username,
933
- password: password,
934
- authData: authData
935
- });
936
- return user.logIn(options);
937
- }
938
-
939
883
  /**
940
884
  * Logs in a user with an objectId. On success, this saves the session
941
885
  * to disk, so you can retrieve the currently logged in user using
@@ -1385,8 +1329,7 @@ var DefaultController = {
1385
1329
  var stateController = _CoreManager.default.getObjectStateController();
1386
1330
  var auth = {
1387
1331
  username: user.get('username'),
1388
- password: user.get('password'),
1389
- authData: user.get('authData')
1332
+ password: user.get('password')
1390
1333
  };
1391
1334
  return RESTController.request(options.usePost ? 'POST' : 'GET', 'login', auth, options).then(function (response) {
1392
1335
  user._migrateId(response.objectId);
@@ -1,11 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
3
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
5
- _Object$defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
4
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
10
5
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
11
6
  /**
@@ -93,6 +88,4 @@ var Storage = {
93
88
  }
94
89
  };
95
90
  module.exports = Storage;
96
- var _default = Storage;
97
- exports.default = _default;
98
91
  _CoreManager.default.setStorageController(require('./StorageController.browser'));
package/lib/node/Cloud.js CHANGED
@@ -56,9 +56,6 @@ function run(name /*: string*/, data /*: mixed*/, options /*: RequestOptions*/)
56
56
  if (options.sessionToken) {
57
57
  requestOptions.sessionToken = options.sessionToken;
58
58
  }
59
- if (options.installationId) {
60
- requestOptions.installationId = options.installationId;
61
- }
62
59
  if (options.context && typeof options.context === 'object') {
63
60
  requestOptions.context = options.context;
64
61
  }
@@ -1,9 +1,5 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
3
  /*
8
4
  * @flow
9
5
  */
@@ -183,7 +179,7 @@ const config /*: Config & { [key: string]: mixed }*/ = {
183
179
  SERVER_AUTH_TOKEN: null,
184
180
  LIVEQUERY_SERVER_URL: null,
185
181
  ENCRYPTED_KEY: null,
186
- VERSION: 'js' + "4.2.0-alpha.9",
182
+ VERSION: 'js' + "4.2.0",
187
183
  APPLICATION_ID: null,
188
184
  JAVASCRIPT_KEY: null,
189
185
  MASTER_KEY: null,
@@ -192,8 +188,7 @@ const config /*: Config & { [key: string]: mixed }*/ = {
192
188
  FORCE_REVOCABLE_SESSION: false,
193
189
  ENCRYPTED_USER: false,
194
190
  IDEMPOTENCY: false,
195
- ALLOW_CUSTOM_OBJECT_ID: false,
196
- PARSE_ERRORS: []
191
+ ALLOW_CUSTOM_OBJECT_ID: false
197
192
  };
198
193
  function requireMethods(name /*: string*/, methods /*: Array<string>*/, controller /*: any*/) {
199
194
  methods.forEach(func => {
@@ -202,7 +197,7 @@ function requireMethods(name /*: string*/, methods /*: Array<string>*/, controll
202
197
  }
203
198
  });
204
199
  }
205
- const CoreManager = {
200
+ module.exports = {
206
201
  get: function (key /*: string*/) /*: any*/{
207
202
  if (config.hasOwnProperty(key)) {
208
203
  return config[key];
@@ -362,7 +357,4 @@ const CoreManager = {
362
357
  getHooksController() /*: HooksController*/{
363
358
  return config['HooksController'];
364
359
  }
365
- };
366
- module.exports = CoreManager;
367
- var _default = CoreManager;
368
- exports.default = _default;
360
+ };
@@ -1,11 +1,6 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
3
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
8
- var _ParseError = _interopRequireDefault(require("./ParseError"));
9
4
  var _ParseObject = _interopRequireDefault(require("./ParseObject"));
10
5
  var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
11
6
  var _Storage = _interopRequireDefault(require("./Storage"));
@@ -268,7 +263,7 @@ const EventuallyQueue = {
268
263
  await object.save(queueObject.object, queueObject.serverOptions);
269
264
  await this.remove(queueObject.queueId);
270
265
  } catch (e) {
271
- if (e.code !== _ParseError.default.CONNECTION_FAILED) {
266
+ if (e.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"') {
272
267
  await this.remove(queueObject.queueId);
273
268
  }
274
269
  }
@@ -278,7 +273,7 @@ const EventuallyQueue = {
278
273
  await object.destroy(queueObject.serverOptions);
279
274
  await this.remove(queueObject.queueId);
280
275
  } catch (e) {
281
- if (e.code !== _ParseError.default.CONNECTION_FAILED) {
276
+ if (e.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"') {
282
277
  await this.remove(queueObject.queueId);
283
278
  }
284
279
  }
@@ -367,6 +362,4 @@ const EventuallyQueue = {
367
362
  }
368
363
  }
369
364
  };
370
- module.exports = EventuallyQueue;
371
- var _default = EventuallyQueue;
372
- exports.default = _default;
365
+ module.exports = EventuallyQueue;
@@ -1,9 +1,5 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
3
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
8
4
  var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
9
5
  var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
@@ -374,7 +370,5 @@ const LocalDatastore = {
374
370
  }
375
371
  };
376
372
  module.exports = LocalDatastore;
377
- var _default = LocalDatastore;
378
- exports.default = _default;
379
373
  _CoreManager.default.setLocalDatastoreController(require('./LocalDatastoreController'));
380
374
  _CoreManager.default.setLocalDatastore(LocalDatastore);
@@ -150,9 +150,7 @@ function estimateAttributes(serverData /*: AttributeMap*/, pendingOps /*: Array<
150
150
  function nestedSet(obj, key, value) {
151
151
  const path = key.split('.');
152
152
  for (let i = 0; i < path.length - 1; i++) {
153
- if (!(path[i] in obj)) {
154
- obj[path[i]] = {};
155
- }
153
+ if (!(path[i] in obj)) obj[path[i]] = {};
156
154
  obj = obj[path[i]];
157
155
  }
158
156
  if (typeof value === 'undefined') {
@@ -493,7 +493,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
493
493
  const distance = point.radiansTo(centerPoint);
494
494
  return distance <= maxDistance;
495
495
  }
496
- return false;
496
+ break;
497
497
  }
498
498
  case '$geoIntersects':
499
499
  {