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.
package/dist/parse.js CHANGED
@@ -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,
@@ -3611,7 +3611,9 @@ function estimateAttributes(serverData /*: AttributeMap*/, pendingOps /*: Array<
3611
3611
  function nestedSet(obj, key, value) {
3612
3612
  var path = key.split('.');
3613
3613
  for (var i = 0; i < path.length - 1; i++) {
3614
- if (!(path[i] in obj)) obj[path[i]] = {};
3614
+ if (!(path[i] in obj)) {
3615
+ obj[path[i]] = {};
3616
+ }
3615
3617
  obj = obj[path[i]];
3616
3618
  }
3617
3619
  if (typeof value === 'undefined') {
@@ -4240,7 +4242,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
4240
4242
  var _distance = point.radiansTo(centerPoint);
4241
4243
  return _distance <= maxDistance;
4242
4244
  }
4243
- break;
4245
+ return false;
4244
4246
  }
4245
4247
  case '$geoIntersects':
4246
4248
  {
@@ -9024,7 +9026,7 @@ var ParseObject = /*#__PURE__*/function () {
9024
9026
  /**
9025
9027
  * Returns the ACL for this object.
9026
9028
  *
9027
- * @returns {Parse.ACL} An instance of Parse.ACL.
9029
+ * @returns {Parse.ACL|null} An instance of Parse.ACL.
9028
9030
  * @see Parse.Object#get
9029
9031
  */
9030
9032
  }, {
@@ -15163,8 +15165,14 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
15163
15165
  throw new Error('Invalid type: authData field should be an object');
15164
15166
  }
15165
15167
  authData[authType] = options.authData;
15168
+ var oldAnonymousData = authData.anonymous;
15169
+ this.stripAnonymity();
15166
15170
  var controller = _CoreManager.default.getUserController();
15167
- return controller.linkWith(this, authData, saveOpts);
15171
+ return controller.linkWith(this, authData, saveOpts).catch(function (e) {
15172
+ delete authData[authType];
15173
+ _this2.restoreAnonimity(oldAnonymousData);
15174
+ throw e;
15175
+ });
15168
15176
  } else {
15169
15177
  return new _promise.default(function (resolve, reject) {
15170
15178
  provider.authenticate({
@@ -15395,6 +15403,24 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
15395
15403
  }
15396
15404
  return isCurrentAsync;
15397
15405
  }()
15406
+ }, {
15407
+ key: "stripAnonymity",
15408
+ value: function () {
15409
+ var authData = this.get('authData');
15410
+ if (authData && (0, _typeof2.default)(authData) === 'object' && authData.hasOwnProperty('anonymous')) {
15411
+ // We need to set anonymous to null instead of deleting it in order to remove it from Parse.
15412
+ authData.anonymous = null;
15413
+ }
15414
+ }
15415
+ }, {
15416
+ key: "restoreAnonimity",
15417
+ value: function (anonymousData /*: any*/) {
15418
+ if (anonymousData) {
15419
+ var authData = this.get('authData');
15420
+ authData.anonymous = anonymousData;
15421
+ }
15422
+ }
15423
+
15398
15424
  /**
15399
15425
  * Returns get("username").
15400
15426
  *
@@ -15418,12 +15444,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
15418
15444
  }, {
15419
15445
  key: "setUsername",
15420
15446
  value: function (username /*: string*/) {
15421
- // Strip anonymity
15422
- var authData = this.get('authData');
15423
- if (authData && (0, _typeof2.default)(authData) === 'object' && authData.hasOwnProperty('anonymous')) {
15424
- // We need to set anonymous to null instead of deleting it in order to remove it from Parse.
15425
- authData.anonymous = null;
15426
- }
15447
+ this.stripAnonymity();
15427
15448
  this.set('username', username);
15428
15449
  }
15429
15450
 
@@ -18612,7 +18633,10 @@ function _regeneratorRuntime() {
18612
18633
  if ("executing" === state) throw new Error("Generator is already running");
18613
18634
  if ("completed" === state) {
18614
18635
  if ("throw" === method) throw arg;
18615
- return doneResult();
18636
+ return {
18637
+ value: void 0,
18638
+ done: !0
18639
+ };
18616
18640
  }
18617
18641
  for (context.method = method, context.arg = arg;;) {
18618
18642
  var delegate = context.delegate;
@@ -18666,7 +18690,7 @@ function _regeneratorRuntime() {
18666
18690
  }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
18667
18691
  }
18668
18692
  function values(iterable) {
18669
- if (iterable) {
18693
+ if (iterable || "" === iterable) {
18670
18694
  var iteratorMethod = iterable[iteratorSymbol];
18671
18695
  if (iteratorMethod) return iteratorMethod.call(iterable);
18672
18696
  if ("function" == typeof iterable.next) return iterable;
@@ -18679,15 +18703,7 @@ function _regeneratorRuntime() {
18679
18703
  return next.next = next;
18680
18704
  }
18681
18705
  }
18682
- return {
18683
- next: doneResult
18684
- };
18685
- }
18686
- function doneResult() {
18687
- return {
18688
- value: undefined,
18689
- done: !0
18690
- };
18706
+ throw new TypeError(_typeof(iterable) + " is not iterable");
18691
18707
  }
18692
18708
  return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
18693
18709
  value: GeneratorFunctionPrototype,