parse 4.2.0-alpha.6 → 4.2.0-alpha.7

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Parse JavaScript SDK v4.2.0-alpha.6
2
+ * Parse JavaScript SDK v4.2.0-alpha.7
3
3
  *
4
4
  * The source tree of this library can be found at
5
5
  * https://github.com/ParsePlatform/Parse-SDK-JS
@@ -538,7 +538,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
538
538
  SERVER_AUTH_TOKEN: null,
539
539
  LIVEQUERY_SERVER_URL: null,
540
540
  ENCRYPTED_KEY: null,
541
- VERSION: 'js' + "4.2.0-alpha.6",
541
+ VERSION: 'js' + "4.2.0-alpha.7",
542
542
  APPLICATION_ID: null,
543
543
  JAVASCRIPT_KEY: null,
544
544
  MASTER_KEY: null,
@@ -3576,7 +3576,9 @@ function estimateAttributes(serverData /*: AttributeMap*/, pendingOps /*: Array<
3576
3576
  function nestedSet(obj, key, value) {
3577
3577
  var path = key.split('.');
3578
3578
  for (var i = 0; i < path.length - 1; i++) {
3579
- if (!(path[i] in obj)) obj[path[i]] = {};
3579
+ if (!(path[i] in obj)) {
3580
+ obj[path[i]] = {};
3581
+ }
3580
3582
  obj = obj[path[i]];
3581
3583
  }
3582
3584
  if (typeof value === 'undefined') {
@@ -4205,7 +4207,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
4205
4207
  var _distance = point.radiansTo(centerPoint);
4206
4208
  return _distance <= maxDistance;
4207
4209
  }
4208
- break;
4210
+ return false;
4209
4211
  }
4210
4212
  case '$geoIntersects':
4211
4213
  {
@@ -8982,7 +8984,7 @@ var ParseObject = /*#__PURE__*/function () {
8982
8984
  /**
8983
8985
  * Returns the ACL for this object.
8984
8986
  *
8985
- * @returns {Parse.ACL} An instance of Parse.ACL.
8987
+ * @returns {Parse.ACL|null} An instance of Parse.ACL.
8986
8988
  * @see Parse.Object#get
8987
8989
  */
8988
8990
  }, {
@@ -15121,8 +15123,14 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
15121
15123
  throw new Error('Invalid type: authData field should be an object');
15122
15124
  }
15123
15125
  authData[authType] = options.authData;
15126
+ var oldAnonymousData = authData.anonymous;
15127
+ this.stripAnonymity();
15124
15128
  var controller = _CoreManager.default.getUserController();
15125
- return controller.linkWith(this, authData, saveOpts);
15129
+ return controller.linkWith(this, authData, saveOpts).catch(function (e) {
15130
+ delete authData[authType];
15131
+ _this2.restoreAnonimity(oldAnonymousData);
15132
+ throw e;
15133
+ });
15126
15134
  } else {
15127
15135
  return new _promise.default(function (resolve, reject) {
15128
15136
  provider.authenticate({
@@ -15353,6 +15361,24 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
15353
15361
  }
15354
15362
  return isCurrentAsync;
15355
15363
  }()
15364
+ }, {
15365
+ key: "stripAnonymity",
15366
+ value: function () {
15367
+ var authData = this.get('authData');
15368
+ if (authData && (0, _typeof2.default)(authData) === 'object' && authData.hasOwnProperty('anonymous')) {
15369
+ // We need to set anonymous to null instead of deleting it in order to remove it from Parse.
15370
+ authData.anonymous = null;
15371
+ }
15372
+ }
15373
+ }, {
15374
+ key: "restoreAnonimity",
15375
+ value: function (anonymousData /*: any*/) {
15376
+ if (anonymousData) {
15377
+ var authData = this.get('authData');
15378
+ authData.anonymous = anonymousData;
15379
+ }
15380
+ }
15381
+
15356
15382
  /**
15357
15383
  * Returns get("username").
15358
15384
  *
@@ -15376,12 +15402,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
15376
15402
  }, {
15377
15403
  key: "setUsername",
15378
15404
  value: function (username /*: string*/) {
15379
- // Strip anonymity
15380
- var authData = this.get('authData');
15381
- if (authData && (0, _typeof2.default)(authData) === 'object' && authData.hasOwnProperty('anonymous')) {
15382
- // We need to set anonymous to null instead of deleting it in order to remove it from Parse.
15383
- authData.anonymous = null;
15384
- }
15405
+ this.stripAnonymity();
15385
15406
  this.set('username', username);
15386
15407
  }
15387
15408
 
@@ -18725,7 +18746,10 @@ function _regeneratorRuntime() {
18725
18746
  if ("executing" === state) throw new Error("Generator is already running");
18726
18747
  if ("completed" === state) {
18727
18748
  if ("throw" === method) throw arg;
18728
- return doneResult();
18749
+ return {
18750
+ value: void 0,
18751
+ done: !0
18752
+ };
18729
18753
  }
18730
18754
  for (context.method = method, context.arg = arg;;) {
18731
18755
  var delegate = context.delegate;
@@ -18779,7 +18803,7 @@ function _regeneratorRuntime() {
18779
18803
  }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
18780
18804
  }
18781
18805
  function values(iterable) {
18782
- if (iterable) {
18806
+ if (iterable || "" === iterable) {
18783
18807
  var iteratorMethod = iterable[iteratorSymbol];
18784
18808
  if (iteratorMethod) return iteratorMethod.call(iterable);
18785
18809
  if ("function" == typeof iterable.next) return iterable;
@@ -18792,15 +18816,7 @@ function _regeneratorRuntime() {
18792
18816
  return next.next = next;
18793
18817
  }
18794
18818
  }
18795
- return {
18796
- next: doneResult
18797
- };
18798
- }
18799
- function doneResult() {
18800
- return {
18801
- value: undefined,
18802
- done: !0
18803
- };
18819
+ throw new TypeError(_typeof(iterable) + " is not iterable");
18804
18820
  }
18805
18821
  return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
18806
18822
  value: GeneratorFunctionPrototype,