parse 4.3.1-alpha.1 → 4.3.1-alpha.2

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.3.1-alpha.1
2
+ * Parse JavaScript SDK v4.3.1-alpha.2
3
3
  *
4
4
  * The source tree of this library can be found at
5
5
  * https://github.com/ParsePlatform/Parse-SDK-JS
@@ -557,7 +557,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
557
557
  SERVER_AUTH_TOKEN: null,
558
558
  LIVEQUERY_SERVER_URL: null,
559
559
  ENCRYPTED_KEY: null,
560
- VERSION: 'js' + "4.3.1-alpha.1",
560
+ VERSION: 'js' + "4.3.1-alpha.2",
561
561
  APPLICATION_ID: null,
562
562
  JAVASCRIPT_KEY: null,
563
563
  MASTER_KEY: null,
@@ -3532,16 +3532,13 @@ function mergeFirstPendingState(pendingOps /*: Array<OpsMap>*/) {
3532
3532
  }
3533
3533
  }
3534
3534
  }
3535
- function estimateAttribute(serverData /*: AttributeMap*/, pendingOps /*: Array<OpsMap>*/, className /*: string*/, id /*: ?string*/, attr /*: string*/) /*: mixed*/{
3535
+ function estimateAttribute(serverData /*: AttributeMap*/, pendingOps /*: Array<OpsMap>*/, object /*: ParseObject*/, attr /*: string*/) /*: mixed*/{
3536
3536
  var value = serverData[attr];
3537
3537
  for (var i = 0; i < pendingOps.length; i++) {
3538
3538
  if (pendingOps[i][attr]) {
3539
3539
  if (pendingOps[i][attr] instanceof _ParseOp.RelationOp) {
3540
- if (id) {
3541
- value = pendingOps[i][attr].applyTo(value, {
3542
- className: className,
3543
- id: id
3544
- }, attr);
3540
+ if (object.id) {
3541
+ value = pendingOps[i][attr].applyTo(value, object, attr);
3545
3542
  }
3546
3543
  } else {
3547
3544
  value = pendingOps[i][attr].applyTo(value);
@@ -3550,7 +3547,7 @@ function estimateAttribute(serverData /*: AttributeMap*/, pendingOps /*: Array<O
3550
3547
  }
3551
3548
  return value;
3552
3549
  }
3553
- function estimateAttributes(serverData /*: AttributeMap*/, pendingOps /*: Array<OpsMap>*/, className /*: string*/, id /*: ?string*/) /*: AttributeMap*/{
3550
+ function estimateAttributes(serverData /*: AttributeMap*/, pendingOps /*: Array<OpsMap>*/, object /*: ParseObject*/) /*: AttributeMap*/{
3554
3551
  var data = {};
3555
3552
  for (var attr in serverData) {
3556
3553
  data[attr] = serverData[attr];
@@ -3558,11 +3555,8 @@ function estimateAttributes(serverData /*: AttributeMap*/, pendingOps /*: Array<
3558
3555
  for (var i = 0; i < pendingOps.length; i++) {
3559
3556
  for (attr in pendingOps[i]) {
3560
3557
  if (pendingOps[i][attr] instanceof _ParseOp.RelationOp) {
3561
- if (id) {
3562
- data[attr] = pendingOps[i][attr].applyTo(data[attr], {
3563
- className: className,
3564
- id: id
3565
- }, attr);
3558
+ if (object.id) {
3559
+ data[attr] = pendingOps[i][attr].applyTo(data[attr], object, attr);
3566
3560
  }
3567
3561
  } else {
3568
3562
  if ((0, _includes.default)(attr).call(attr, '.')) {
@@ -3571,15 +3565,15 @@ function estimateAttributes(serverData /*: AttributeMap*/, pendingOps /*: Array<
3571
3565
  var first = fields[0];
3572
3566
  var last = fields[fields.length - 1];
3573
3567
  data[first] = _objectSpread({}, serverData[first]);
3574
- var object = _objectSpread({}, data);
3568
+ var _object = _objectSpread({}, data);
3575
3569
  for (var _i = 0; _i < fields.length - 1; _i++) {
3576
3570
  var key = fields[_i];
3577
- if (!(key in object)) {
3578
- object[key] = {};
3571
+ if (!(key in _object)) {
3572
+ _object[key] = {};
3579
3573
  }
3580
- object = object[key];
3574
+ _object = _object[key];
3581
3575
  }
3582
- object[last] = pendingOps[i][attr].applyTo(object[last]);
3576
+ _object[last] = pendingOps[i][attr].applyTo(_object[last]);
3583
3577
  } else {
3584
3578
  data[attr] = pendingOps[i][attr].applyTo(data[attr]);
3585
3579
  }
@@ -11286,18 +11280,11 @@ var RelationOp = /*#__PURE__*/function (_Op7) {
11286
11280
  }
11287
11281
  }, {
11288
11282
  key: "applyTo",
11289
- value: function (value /*: mixed*/, object /*:: ?: { className: string, id: ?string }*/, key /*:: ?: string*/) /*: ?ParseRelation*/{
11283
+ value: function (value /*: mixed*/, parent /*: ParseObject*/, key /*:: ?: string*/) /*: ?ParseRelation*/{
11290
11284
  if (!value) {
11291
- var _context3;
11292
- if (!object || !key) {
11285
+ if (!parent || !key) {
11293
11286
  throw new Error('Cannot apply a RelationOp without either a previous value, or an object and a key');
11294
11287
  }
11295
- var parent = new _ParseObject.default(object.className);
11296
- if (object.id && (0, _indexOf.default)(_context3 = object.id).call(_context3, 'local') === 0) {
11297
- parent._localId = object.id;
11298
- } else if (object.id) {
11299
- parent.id = object.id;
11300
- }
11301
11288
  var relation = new _ParseRelation.default(parent, key);
11302
11289
  relation.targetClassName = this._targetClassName;
11303
11290
  return relation;
@@ -11327,31 +11314,31 @@ var RelationOp = /*#__PURE__*/function (_Op7) {
11327
11314
  } else if (previous instanceof SetOp && previous._value instanceof _ParseRelation.default) {
11328
11315
  return this;
11329
11316
  } else if (previous instanceof RelationOp) {
11330
- var _context4, _context5, _context6, _context7, _context8, _context9;
11317
+ var _context3, _context4, _context5, _context6, _context7, _context8;
11331
11318
  if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
11332
11319
  throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + (this._targetClassName || 'null') + ' was passed in.');
11333
11320
  }
11334
- var newAdd = (0, _concat.default)(_context4 = previous.relationsToAdd).call(_context4, []);
11335
- (0, _forEach.default)(_context5 = this.relationsToRemove).call(_context5, function (r) {
11321
+ var newAdd = (0, _concat.default)(_context3 = previous.relationsToAdd).call(_context3, []);
11322
+ (0, _forEach.default)(_context4 = this.relationsToRemove).call(_context4, function (r) {
11336
11323
  var index = (0, _indexOf.default)(newAdd).call(newAdd, r);
11337
11324
  if (index > -1) {
11338
11325
  (0, _splice.default)(newAdd).call(newAdd, index, 1);
11339
11326
  }
11340
11327
  });
11341
- (0, _forEach.default)(_context6 = this.relationsToAdd).call(_context6, function (r) {
11328
+ (0, _forEach.default)(_context5 = this.relationsToAdd).call(_context5, function (r) {
11342
11329
  var index = (0, _indexOf.default)(newAdd).call(newAdd, r);
11343
11330
  if (index < 0) {
11344
11331
  newAdd.push(r);
11345
11332
  }
11346
11333
  });
11347
- var newRemove = (0, _concat.default)(_context7 = previous.relationsToRemove).call(_context7, []);
11348
- (0, _forEach.default)(_context8 = this.relationsToAdd).call(_context8, function (r) {
11334
+ var newRemove = (0, _concat.default)(_context6 = previous.relationsToRemove).call(_context6, []);
11335
+ (0, _forEach.default)(_context7 = this.relationsToAdd).call(_context7, function (r) {
11349
11336
  var index = (0, _indexOf.default)(newRemove).call(newRemove, r);
11350
11337
  if (index > -1) {
11351
11338
  (0, _splice.default)(newRemove).call(newRemove, index, 1);
11352
11339
  }
11353
11340
  });
11354
- (0, _forEach.default)(_context9 = this.relationsToRemove).call(_context9, function (r) {
11341
+ (0, _forEach.default)(_context8 = this.relationsToRemove).call(_context8, function (r) {
11355
11342
  var index = (0, _indexOf.default)(newRemove).call(newRemove, r);
11356
11343
  if (index < 0) {
11357
11344
  newRemove.push(r);
@@ -11378,16 +11365,16 @@ var RelationOp = /*#__PURE__*/function (_Op7) {
11378
11365
  var removes = null;
11379
11366
  var pointers = null;
11380
11367
  if (this.relationsToAdd.length > 0) {
11381
- var _context10;
11382
- pointers = (0, _map.default)(_context10 = this.relationsToAdd).call(_context10, idToPointer);
11368
+ var _context9;
11369
+ pointers = (0, _map.default)(_context9 = this.relationsToAdd).call(_context9, idToPointer);
11383
11370
  adds = {
11384
11371
  __op: 'AddRelation',
11385
11372
  objects: pointers
11386
11373
  };
11387
11374
  }
11388
11375
  if (this.relationsToRemove.length > 0) {
11389
- var _context11;
11390
- pointers = (0, _map.default)(_context11 = this.relationsToRemove).call(_context11, idToPointer);
11376
+ var _context10;
11377
+ pointers = (0, _map.default)(_context10 = this.relationsToRemove).call(_context10, idToPointer);
11391
11378
  removes = {
11392
11379
  __op: 'RemoveRelation',
11393
11380
  objects: pointers
@@ -17063,6 +17050,7 @@ var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
17063
17050
  var _WeakMap = _dereq_("@babel/runtime-corejs3/core-js-stable/weak-map");
17064
17051
  var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
17065
17052
  var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
17053
+ var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
17066
17054
  _Object$defineProperty(exports, "__esModule", {
17067
17055
  value: true
17068
17056
  });
@@ -17084,6 +17072,7 @@ exports.removeState = removeState;
17084
17072
  exports.setPendingOp = setPendingOp;
17085
17073
  exports.setServerData = setServerData;
17086
17074
  var ObjectStateMutations = _interopRequireWildcard(_dereq_("./ObjectStateMutations"));
17075
+ var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
17087
17076
  function _getRequireWildcardCache(nodeInterop) {
17088
17077
  if (typeof _WeakMap !== "function") return null;
17089
17078
  var cacheBabelInterop = new _WeakMap();
@@ -17207,15 +17196,15 @@ function getObjectCache(obj /*: ObjectIdentifier*/) /*: ObjectCache*/{
17207
17196
  }
17208
17197
  return {};
17209
17198
  }
17210
- function estimateAttribute(obj /*: ObjectIdentifier*/, attr /*: string*/) /*: mixed*/{
17199
+ function estimateAttribute(obj /*: ParseObject*/, attr /*: string*/) /*: mixed*/{
17211
17200
  var serverData = getServerData(obj);
17212
17201
  var pendingOps = getPendingOps(obj);
17213
- return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj.className, obj.id, attr);
17202
+ return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj, attr);
17214
17203
  }
17215
- function estimateAttributes(obj /*: ObjectIdentifier*/) /*: AttributeMap*/{
17204
+ function estimateAttributes(obj /*: ParseObject*/) /*: AttributeMap*/{
17216
17205
  var serverData = getServerData(obj);
17217
17206
  var pendingOps = getPendingOps(obj);
17218
- return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj.className, obj.id);
17207
+ return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj);
17219
17208
  }
17220
17209
  function commitServerChanges(obj /*: ObjectIdentifier*/, changes /*: AttributeMap*/) {
17221
17210
  var state = initializeState(obj);
@@ -17231,7 +17220,7 @@ function clearAllState() {
17231
17220
  function duplicateState(source /*: { id: string }*/, dest /*: { id: string }*/) {
17232
17221
  dest.id = source.id;
17233
17222
  }
17234
- },{"./ObjectStateMutations":16,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":86,"@babel/runtime-corejs3/core-js-stable/weak-map":98,"@babel/runtime-corejs3/helpers/typeof":127}],39:[function(_dereq_,module,exports){
17223
+ },{"./ObjectStateMutations":16,"./ParseObject":27,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":86,"@babel/runtime-corejs3/core-js-stable/weak-map":98,"@babel/runtime-corejs3/helpers/interopRequireDefault":112,"@babel/runtime-corejs3/helpers/typeof":127}],39:[function(_dereq_,module,exports){
17235
17224
  "use strict";
17236
17225
 
17237
17226
  var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
@@ -17620,12 +17609,12 @@ function getObjectCache(obj /*: ParseObject*/) /*: ObjectCache*/{
17620
17609
  function estimateAttribute(obj /*: ParseObject*/, attr /*: string*/) /*: mixed*/{
17621
17610
  var serverData = getServerData(obj);
17622
17611
  var pendingOps = getPendingOps(obj);
17623
- return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj.className, obj.id, attr);
17612
+ return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj, attr);
17624
17613
  }
17625
17614
  function estimateAttributes(obj /*: ParseObject*/) /*: AttributeMap*/{
17626
17615
  var serverData = getServerData(obj);
17627
17616
  var pendingOps = getPendingOps(obj);
17628
- return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj.className, obj.id);
17617
+ return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj);
17629
17618
  }
17630
17619
  function commitServerChanges(obj /*: ParseObject*/, changes /*: AttributeMap*/) {
17631
17620
  var state = initializeState(obj);