parse 4.3.1-beta.1 → 5.0.0-alpha.1

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/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  [![Snyk Badge](https://snyk.io/test/github/parse-community/Parse-SDK-JS/badge.svg)](https://snyk.io/test/github/parse-community/Parse-SDK-JS)
9
9
  [![Coverage](http://codecov.io/github/parse-community/Parse-SDK-JS/coverage.svg?branch=alpha)](http://codecov.io/github/parse-community/Parse-SDK-JS?branch=alpha)
10
10
 
11
- [![Node Version](https://img.shields.io/badge/nodejs-14,_16,_18-green.svg?logo=node.js&style=flat)](https://nodejs.org/)
11
+ [![Node Version](https://img.shields.io/badge/nodejs-18,_20-green.svg?logo=node.js&style=flat)](https://nodejs.org/)
12
12
  [![auto-release](https://img.shields.io/badge/%F0%9F%9A%80-auto--release-9e34eb.svg)](https://github.com/parse-community/parse-dashboard/releases)
13
13
 
14
14
  [![npm latest version](https://img.shields.io/npm/v/parse/latest.svg)](https://www.npmjs.com/package/parse)
@@ -97,10 +97,8 @@ Parse JS SDK is continuously tested with the most recent releases of Node.js to
97
97
 
98
98
  | Version | Latest Version | End-of-Life | Compatible |
99
99
  |------------|----------------|-------------|------------|
100
- | Node.js 14 | 14.19.1 | April 2023 | ✅ Yes |
101
- | Node.js 16 | 16.19.0 | September 2023 | ✅ Yes |
102
- | Node.js 18 | 18.12.1 | April 2025 | ✅ Yes |
103
- | Node.js 19 | 19.3.0 | June 2023 | ✅ Yes |
100
+ | Node.js 18 | 18.19.0 | April 2025 | ✅ Yes |
101
+ | Node.js 20 | 20.10.0 | April 2026 | ✅ Yes |
104
102
 
105
103
 
106
104
  ## Upgrading to Parse SDK 2.0.0
package/dist/parse.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Parse JavaScript SDK v4.3.1-beta.1
2
+ * Parse JavaScript SDK v5.0.0-alpha.1
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-beta.1",
560
+ VERSION: 'js' + "5.0.0-alpha.1",
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
  }
@@ -11293,18 +11287,11 @@ var RelationOp = /*#__PURE__*/function (_Op7) {
11293
11287
  }
11294
11288
  }, {
11295
11289
  key: "applyTo",
11296
- value: function (value /*: mixed*/, object /*:: ?: { className: string, id: ?string }*/, key /*:: ?: string*/) /*: ?ParseRelation*/{
11290
+ value: function (value /*: mixed*/, parent /*: ParseObject*/, key /*:: ?: string*/) /*: ?ParseRelation*/{
11297
11291
  if (!value) {
11298
- var _context3;
11299
- if (!object || !key) {
11292
+ if (!parent || !key) {
11300
11293
  throw new Error('Cannot apply a RelationOp without either a previous value, or an object and a key');
11301
11294
  }
11302
- var parent = new _ParseObject.default(object.className);
11303
- if (object.id && (0, _indexOf.default)(_context3 = object.id).call(_context3, 'local') === 0) {
11304
- parent._localId = object.id;
11305
- } else if (object.id) {
11306
- parent.id = object.id;
11307
- }
11308
11295
  var relation = new _ParseRelation.default(parent, key);
11309
11296
  relation.targetClassName = this._targetClassName;
11310
11297
  return relation;
@@ -11334,31 +11321,31 @@ var RelationOp = /*#__PURE__*/function (_Op7) {
11334
11321
  } else if (previous instanceof SetOp && previous._value instanceof _ParseRelation.default) {
11335
11322
  return this;
11336
11323
  } else if (previous instanceof RelationOp) {
11337
- var _context4, _context5, _context6, _context7, _context8, _context9;
11324
+ var _context3, _context4, _context5, _context6, _context7, _context8;
11338
11325
  if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
11339
11326
  throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + (this._targetClassName || 'null') + ' was passed in.');
11340
11327
  }
11341
- var newAdd = (0, _concat.default)(_context4 = previous.relationsToAdd).call(_context4, []);
11342
- (0, _forEach.default)(_context5 = this.relationsToRemove).call(_context5, function (r) {
11328
+ var newAdd = (0, _concat.default)(_context3 = previous.relationsToAdd).call(_context3, []);
11329
+ (0, _forEach.default)(_context4 = this.relationsToRemove).call(_context4, function (r) {
11343
11330
  var index = (0, _indexOf.default)(newAdd).call(newAdd, r);
11344
11331
  if (index > -1) {
11345
11332
  (0, _splice.default)(newAdd).call(newAdd, index, 1);
11346
11333
  }
11347
11334
  });
11348
- (0, _forEach.default)(_context6 = this.relationsToAdd).call(_context6, function (r) {
11335
+ (0, _forEach.default)(_context5 = this.relationsToAdd).call(_context5, function (r) {
11349
11336
  var index = (0, _indexOf.default)(newAdd).call(newAdd, r);
11350
11337
  if (index < 0) {
11351
11338
  newAdd.push(r);
11352
11339
  }
11353
11340
  });
11354
- var newRemove = (0, _concat.default)(_context7 = previous.relationsToRemove).call(_context7, []);
11355
- (0, _forEach.default)(_context8 = this.relationsToAdd).call(_context8, function (r) {
11341
+ var newRemove = (0, _concat.default)(_context6 = previous.relationsToRemove).call(_context6, []);
11342
+ (0, _forEach.default)(_context7 = this.relationsToAdd).call(_context7, function (r) {
11356
11343
  var index = (0, _indexOf.default)(newRemove).call(newRemove, r);
11357
11344
  if (index > -1) {
11358
11345
  (0, _splice.default)(newRemove).call(newRemove, index, 1);
11359
11346
  }
11360
11347
  });
11361
- (0, _forEach.default)(_context9 = this.relationsToRemove).call(_context9, function (r) {
11348
+ (0, _forEach.default)(_context8 = this.relationsToRemove).call(_context8, function (r) {
11362
11349
  var index = (0, _indexOf.default)(newRemove).call(newRemove, r);
11363
11350
  if (index < 0) {
11364
11351
  newRemove.push(r);
@@ -11385,16 +11372,16 @@ var RelationOp = /*#__PURE__*/function (_Op7) {
11385
11372
  var removes = null;
11386
11373
  var pointers = null;
11387
11374
  if (this.relationsToAdd.length > 0) {
11388
- var _context10;
11389
- pointers = (0, _map.default)(_context10 = this.relationsToAdd).call(_context10, idToPointer);
11375
+ var _context9;
11376
+ pointers = (0, _map.default)(_context9 = this.relationsToAdd).call(_context9, idToPointer);
11390
11377
  adds = {
11391
11378
  __op: 'AddRelation',
11392
11379
  objects: pointers
11393
11380
  };
11394
11381
  }
11395
11382
  if (this.relationsToRemove.length > 0) {
11396
- var _context11;
11397
- pointers = (0, _map.default)(_context11 = this.relationsToRemove).call(_context11, idToPointer);
11383
+ var _context10;
11384
+ pointers = (0, _map.default)(_context10 = this.relationsToRemove).call(_context10, idToPointer);
11398
11385
  removes = {
11399
11386
  __op: 'RemoveRelation',
11400
11387
  objects: pointers
@@ -17069,6 +17056,7 @@ var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
17069
17056
  var _WeakMap = _dereq_("@babel/runtime-corejs3/core-js-stable/weak-map");
17070
17057
  var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
17071
17058
  var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
17059
+ var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
17072
17060
  _Object$defineProperty(exports, "__esModule", {
17073
17061
  value: true
17074
17062
  });
@@ -17090,6 +17078,7 @@ exports.removeState = removeState;
17090
17078
  exports.setPendingOp = setPendingOp;
17091
17079
  exports.setServerData = setServerData;
17092
17080
  var ObjectStateMutations = _interopRequireWildcard(_dereq_("./ObjectStateMutations"));
17081
+ var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
17093
17082
  function _getRequireWildcardCache(nodeInterop) {
17094
17083
  if (typeof _WeakMap !== "function") return null;
17095
17084
  var cacheBabelInterop = new _WeakMap();
@@ -17213,15 +17202,15 @@ function getObjectCache(obj /*: ObjectIdentifier*/) /*: ObjectCache*/{
17213
17202
  }
17214
17203
  return {};
17215
17204
  }
17216
- function estimateAttribute(obj /*: ObjectIdentifier*/, attr /*: string*/) /*: mixed*/{
17205
+ function estimateAttribute(obj /*: ParseObject*/, attr /*: string*/) /*: mixed*/{
17217
17206
  var serverData = getServerData(obj);
17218
17207
  var pendingOps = getPendingOps(obj);
17219
- return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj.className, obj.id, attr);
17208
+ return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj, attr);
17220
17209
  }
17221
- function estimateAttributes(obj /*: ObjectIdentifier*/) /*: AttributeMap*/{
17210
+ function estimateAttributes(obj /*: ParseObject*/) /*: AttributeMap*/{
17222
17211
  var serverData = getServerData(obj);
17223
17212
  var pendingOps = getPendingOps(obj);
17224
- return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj.className, obj.id);
17213
+ return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj);
17225
17214
  }
17226
17215
  function commitServerChanges(obj /*: ObjectIdentifier*/, changes /*: AttributeMap*/) {
17227
17216
  var state = initializeState(obj);
@@ -17237,7 +17226,7 @@ function clearAllState() {
17237
17226
  function duplicateState(source /*: { id: string }*/, dest /*: { id: string }*/) {
17238
17227
  dest.id = source.id;
17239
17228
  }
17240
- },{"./ObjectStateMutations":16,"@babel/runtime-corejs3/core-js-stable/object/define-property":81,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":84,"@babel/runtime-corejs3/core-js-stable/weak-map":96,"@babel/runtime-corejs3/helpers/typeof":125}],39:[function(_dereq_,module,exports){
17229
+ },{"./ObjectStateMutations":16,"./ParseObject":27,"@babel/runtime-corejs3/core-js-stable/object/define-property":81,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":84,"@babel/runtime-corejs3/core-js-stable/weak-map":96,"@babel/runtime-corejs3/helpers/interopRequireDefault":110,"@babel/runtime-corejs3/helpers/typeof":125}],39:[function(_dereq_,module,exports){
17241
17230
  "use strict";
17242
17231
 
17243
17232
  var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
@@ -17583,12 +17572,12 @@ function getObjectCache(obj /*: ParseObject*/) /*: ObjectCache*/{
17583
17572
  function estimateAttribute(obj /*: ParseObject*/, attr /*: string*/) /*: mixed*/{
17584
17573
  var serverData = getServerData(obj);
17585
17574
  var pendingOps = getPendingOps(obj);
17586
- return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj.className, obj.id, attr);
17575
+ return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj, attr);
17587
17576
  }
17588
17577
  function estimateAttributes(obj /*: ParseObject*/) /*: AttributeMap*/{
17589
17578
  var serverData = getServerData(obj);
17590
17579
  var pendingOps = getPendingOps(obj);
17591
- return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj.className, obj.id);
17580
+ return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj);
17592
17581
  }
17593
17582
  function commitServerChanges(obj /*: ParseObject*/, changes /*: AttributeMap*/) {
17594
17583
  var state = initializeState(obj);