parse 4.2.0-alpha.6 → 4.2.0-alpha.8

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.8
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.8",
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
 
@@ -15510,6 +15531,9 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
15510
15531
  if (options.hasOwnProperty('usePost')) {
15511
15532
  loginOptions.usePost = options.usePost;
15512
15533
  }
15534
+ if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
15535
+ loginOptions.context = options.context;
15536
+ }
15513
15537
  var controller = _CoreManager.default.getUserController();
15514
15538
  return controller.logIn(this, loginOptions);
15515
15539
  }
@@ -18725,7 +18749,10 @@ function _regeneratorRuntime() {
18725
18749
  if ("executing" === state) throw new Error("Generator is already running");
18726
18750
  if ("completed" === state) {
18727
18751
  if ("throw" === method) throw arg;
18728
- return doneResult();
18752
+ return {
18753
+ value: void 0,
18754
+ done: !0
18755
+ };
18729
18756
  }
18730
18757
  for (context.method = method, context.arg = arg;;) {
18731
18758
  var delegate = context.delegate;
@@ -18779,7 +18806,7 @@ function _regeneratorRuntime() {
18779
18806
  }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
18780
18807
  }
18781
18808
  function values(iterable) {
18782
- if (iterable) {
18809
+ if (iterable || "" === iterable) {
18783
18810
  var iteratorMethod = iterable[iteratorSymbol];
18784
18811
  if (iteratorMethod) return iteratorMethod.call(iterable);
18785
18812
  if ("function" == typeof iterable.next) return iterable;
@@ -18792,15 +18819,7 @@ function _regeneratorRuntime() {
18792
18819
  return next.next = next;
18793
18820
  }
18794
18821
  }
18795
- return {
18796
- next: doneResult
18797
- };
18798
- }
18799
- function doneResult() {
18800
- return {
18801
- value: undefined,
18802
- done: !0
18803
- };
18822
+ throw new TypeError(_typeof(iterable) + " is not iterable");
18804
18823
  }
18805
18824
  return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
18806
18825
  value: GeneratorFunctionPrototype,