parse 4.0.0-alpha.6 → 4.0.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.
@@ -2522,11 +2522,9 @@ class ParseObject {
2522
2522
 
2523
2523
  if (this.hasOwnProperty('__super__') && this.__super__) {
2524
2524
  parentProto = this.prototype;
2525
- } else if (classMap[adjustedClassName]) {
2526
- parentProto = classMap[adjustedClassName].prototype;
2527
2525
  }
2528
2526
 
2529
- const ParseObjectSubclass = function (attributes, options) {
2527
+ let ParseObjectSubclass = function (attributes, options) {
2530
2528
  this.className = adjustedClassName;
2531
2529
  this._objCount = objectCount++; // Enable legacy initializers
2532
2530
 
@@ -2534,6 +2532,12 @@ class ParseObject {
2534
2532
  this.initialize.apply(this, arguments);
2535
2533
  }
2536
2534
 
2535
+ if (this._initializers) {
2536
+ for (const initializer of this._initializers) {
2537
+ initializer.apply(this, arguments);
2538
+ }
2539
+ }
2540
+
2537
2541
  if (attributes && typeof attributes === 'object') {
2538
2542
  if (!this.set(attributes || {}, options)) {
2539
2543
  throw new Error("Can't create an invalid Parse Object");
@@ -2541,19 +2545,42 @@ class ParseObject {
2541
2545
  }
2542
2546
  };
2543
2547
 
2544
- ParseObjectSubclass.className = adjustedClassName;
2545
- ParseObjectSubclass.__super__ = parentProto;
2546
- ParseObjectSubclass.prototype = Object.create(parentProto, {
2547
- constructor: {
2548
- value: ParseObjectSubclass,
2549
- enumerable: false,
2550
- writable: true,
2551
- configurable: true
2552
- }
2553
- });
2548
+ if (classMap[adjustedClassName]) {
2549
+ ParseObjectSubclass = classMap[adjustedClassName];
2550
+ } else {
2551
+ ParseObjectSubclass.extend = function (name, protoProps, classProps) {
2552
+ if (typeof name === 'string') {
2553
+ return ParseObject.extend.call(ParseObjectSubclass, name, protoProps, classProps);
2554
+ }
2555
+
2556
+ return ParseObject.extend.call(ParseObjectSubclass, adjustedClassName, name, protoProps);
2557
+ };
2558
+
2559
+ ParseObjectSubclass.createWithoutData = ParseObject.createWithoutData;
2560
+ ParseObjectSubclass.className = adjustedClassName;
2561
+ ParseObjectSubclass.__super__ = parentProto;
2562
+ ParseObjectSubclass.prototype = Object.create(parentProto, {
2563
+ constructor: {
2564
+ value: ParseObjectSubclass,
2565
+ enumerable: false,
2566
+ writable: true,
2567
+ configurable: true
2568
+ }
2569
+ });
2570
+ }
2554
2571
 
2555
2572
  if (protoProps) {
2556
2573
  for (const prop in protoProps) {
2574
+ if (prop === 'initialize') {
2575
+ Object.defineProperty(ParseObjectSubclass.prototype, '_initializers', {
2576
+ value: [...(ParseObjectSubclass.prototype._initializers || []), protoProps[prop]],
2577
+ enumerable: false,
2578
+ writable: true,
2579
+ configurable: true
2580
+ });
2581
+ continue;
2582
+ }
2583
+
2557
2584
  if (prop !== 'className') {
2558
2585
  Object.defineProperty(ParseObjectSubclass.prototype, prop, {
2559
2586
  value: protoProps[prop],
@@ -2578,15 +2605,6 @@ class ParseObject {
2578
2605
  }
2579
2606
  }
2580
2607
 
2581
- ParseObjectSubclass.extend = function (name, protoProps, classProps) {
2582
- if (typeof name === 'string') {
2583
- return ParseObject.extend.call(ParseObjectSubclass, name, protoProps, classProps);
2584
- }
2585
-
2586
- return ParseObject.extend.call(ParseObjectSubclass, adjustedClassName, name, protoProps);
2587
- };
2588
-
2589
- ParseObjectSubclass.createWithoutData = ParseObject.createWithoutData;
2590
2608
  classMap[adjustedClassName] = ParseObjectSubclass;
2591
2609
  return ParseObjectSubclass;
2592
2610
  }
@@ -8,7 +8,7 @@ var config = {
8
8
  SERVER_AUTH_TOKEN: null,
9
9
  LIVEQUERY_SERVER_URL: null,
10
10
  ENCRYPTED_KEY: null,
11
- VERSION: 'js' + "4.0.0-alpha.6",
11
+ VERSION: 'js' + "4.0.0-alpha.7",
12
12
  APPLICATION_ID: null,
13
13
  JAVASCRIPT_KEY: null,
14
14
  MASTER_KEY: null,
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
+
8
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
11
 
10
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -1971,8 +1973,6 @@ var ParseObject = function () {
1971
1973
 
1972
1974
  if (this.hasOwnProperty('__super__') && this.__super__) {
1973
1975
  parentProto = this.prototype;
1974
- } else if (classMap[adjustedClassName]) {
1975
- parentProto = classMap[adjustedClassName].prototype;
1976
1976
  }
1977
1977
 
1978
1978
  var ParseObjectSubclass = function (attributes, options) {
@@ -1983,6 +1983,13 @@ var ParseObject = function () {
1983
1983
  this.initialize.apply(this, arguments);
1984
1984
  }
1985
1985
 
1986
+ if (this._initializers) {
1987
+ for (var _iterator2 = _createForOfIteratorHelperLoose(this._initializers), _step2; !(_step2 = _iterator2()).done;) {
1988
+ var initializer = _step2.value;
1989
+ initializer.apply(this, arguments);
1990
+ }
1991
+ }
1992
+
1986
1993
  if (attributes && typeof attributes === 'object') {
1987
1994
  if (!this.set(attributes || {}, options)) {
1988
1995
  throw new Error("Can't create an invalid Parse Object");
@@ -1990,19 +1997,42 @@ var ParseObject = function () {
1990
1997
  }
1991
1998
  };
1992
1999
 
1993
- ParseObjectSubclass.className = adjustedClassName;
1994
- ParseObjectSubclass.__super__ = parentProto;
1995
- ParseObjectSubclass.prototype = Object.create(parentProto, {
1996
- constructor: {
1997
- value: ParseObjectSubclass,
1998
- enumerable: false,
1999
- writable: true,
2000
- configurable: true
2001
- }
2002
- });
2000
+ if (classMap[adjustedClassName]) {
2001
+ ParseObjectSubclass = classMap[adjustedClassName];
2002
+ } else {
2003
+ ParseObjectSubclass.extend = function (name, protoProps, classProps) {
2004
+ if (typeof name === 'string') {
2005
+ return ParseObject.extend.call(ParseObjectSubclass, name, protoProps, classProps);
2006
+ }
2007
+
2008
+ return ParseObject.extend.call(ParseObjectSubclass, adjustedClassName, name, protoProps);
2009
+ };
2010
+
2011
+ ParseObjectSubclass.createWithoutData = ParseObject.createWithoutData;
2012
+ ParseObjectSubclass.className = adjustedClassName;
2013
+ ParseObjectSubclass.__super__ = parentProto;
2014
+ ParseObjectSubclass.prototype = Object.create(parentProto, {
2015
+ constructor: {
2016
+ value: ParseObjectSubclass,
2017
+ enumerable: false,
2018
+ writable: true,
2019
+ configurable: true
2020
+ }
2021
+ });
2022
+ }
2003
2023
 
2004
2024
  if (protoProps) {
2005
2025
  for (var prop in protoProps) {
2026
+ if (prop === 'initialize') {
2027
+ Object.defineProperty(ParseObjectSubclass.prototype, '_initializers', {
2028
+ value: [].concat((0, _toConsumableArray2.default)(ParseObjectSubclass.prototype._initializers || []), [protoProps[prop]]),
2029
+ enumerable: false,
2030
+ writable: true,
2031
+ configurable: true
2032
+ });
2033
+ continue;
2034
+ }
2035
+
2006
2036
  if (prop !== 'className') {
2007
2037
  Object.defineProperty(ParseObjectSubclass.prototype, prop, {
2008
2038
  value: protoProps[prop],
@@ -2027,15 +2057,6 @@ var ParseObject = function () {
2027
2057
  }
2028
2058
  }
2029
2059
 
2030
- ParseObjectSubclass.extend = function (name, protoProps, classProps) {
2031
- if (typeof name === 'string') {
2032
- return ParseObject.extend.call(ParseObjectSubclass, name, protoProps, classProps);
2033
- }
2034
-
2035
- return ParseObject.extend.call(ParseObjectSubclass, adjustedClassName, name, protoProps);
2036
- };
2037
-
2038
- ParseObjectSubclass.createWithoutData = ParseObject.createWithoutData;
2039
2060
  classMap[adjustedClassName] = ParseObjectSubclass;
2040
2061
  return ParseObjectSubclass;
2041
2062
  }
@@ -2175,7 +2196,7 @@ var DefaultController = {
2175
2196
 
2176
2197
  query._limit = ids.length;
2177
2198
  return query.find(options).then(function (objects) {
2178
- var idMap, i, obj, _i, _obj, id, _iterator2, _step2, object;
2199
+ var idMap, i, obj, _i, _obj, id, _iterator3, _step3, object;
2179
2200
 
2180
2201
  return _regeneratorRuntime().async(function (_context6) {
2181
2202
  while (1) {
@@ -2227,15 +2248,15 @@ var DefaultController = {
2227
2248
  }
2228
2249
  }
2229
2250
 
2230
- _iterator2 = _createForOfIteratorHelperLoose(results);
2251
+ _iterator3 = _createForOfIteratorHelperLoose(results);
2231
2252
 
2232
2253
  case 13:
2233
- if ((_step2 = _iterator2()).done) {
2254
+ if ((_step3 = _iterator3()).done) {
2234
2255
  _context6.next = 19;
2235
2256
  break;
2236
2257
  }
2237
2258
 
2238
- object = _step2.value;
2259
+ object = _step3.value;
2239
2260
  _context6.next = 17;
2240
2261
  return _regeneratorRuntime().awrap(localDatastore._updateObjectIfPinned(object));
2241
2262
 
@@ -2358,7 +2379,7 @@ var DefaultController = {
2358
2379
  });
2359
2380
  });
2360
2381
  return _context10.abrupt("return", deleteCompleted.then(function () {
2361
- var aggregate, _iterator3, _step3, object;
2382
+ var aggregate, _iterator4, _step4, object;
2362
2383
 
2363
2384
  return _regeneratorRuntime().async(function (_context8) {
2364
2385
  while (1) {
@@ -2374,15 +2395,15 @@ var DefaultController = {
2374
2395
  return _context8.abrupt("return", Promise.reject(aggregate));
2375
2396
 
2376
2397
  case 4:
2377
- _iterator3 = _createForOfIteratorHelperLoose(target);
2398
+ _iterator4 = _createForOfIteratorHelperLoose(target);
2378
2399
 
2379
2400
  case 5:
2380
- if ((_step3 = _iterator3()).done) {
2401
+ if ((_step4 = _iterator4()).done) {
2381
2402
  _context8.next = 11;
2382
2403
  break;
2383
2404
  }
2384
2405
 
2385
- object = _step3.value;
2406
+ object = _step4.value;
2386
2407
  _context8.next = 9;
2387
2408
  return _regeneratorRuntime().awrap(localDatastore._destroyObjectIfPinned(object));
2388
2409
 
@@ -2545,7 +2566,7 @@ var DefaultController = {
2545
2566
  });
2546
2567
  return (0, _promiseUtils.when)(batchTasks);
2547
2568
  }).then(function _callee5() {
2548
- var _iterator4, _step4, object;
2569
+ var _iterator5, _step5, object;
2549
2570
 
2550
2571
  return _regeneratorRuntime().async(function _callee5$(_context11) {
2551
2572
  while (1) {
@@ -2559,15 +2580,15 @@ var DefaultController = {
2559
2580
  return _context11.abrupt("return", Promise.reject(objectError));
2560
2581
 
2561
2582
  case 2:
2562
- _iterator4 = _createForOfIteratorHelperLoose(target);
2583
+ _iterator5 = _createForOfIteratorHelperLoose(target);
2563
2584
 
2564
2585
  case 3:
2565
- if ((_step4 = _iterator4()).done) {
2586
+ if ((_step5 = _iterator5()).done) {
2566
2587
  _context11.next = 11;
2567
2588
  break;
2568
2589
  }
2569
2590
 
2570
- object = _step4.value;
2591
+ object = _step5.value;
2571
2592
  _context11.next = 7;
2572
2593
  return _regeneratorRuntime().awrap(localDatastore._updateLocalIdForObject(mapIdForPin[object.id], object));
2573
2594
 
@@ -224,7 +224,7 @@ var config
224
224
  SERVER_AUTH_TOKEN: null,
225
225
  LIVEQUERY_SERVER_URL: null,
226
226
  ENCRYPTED_KEY: null,
227
- VERSION: 'js' + "4.0.0-alpha.6",
227
+ VERSION: 'js' + "4.0.0-alpha.7",
228
228
  APPLICATION_ID: null,
229
229
  JAVASCRIPT_KEY: null,
230
230
  MASTER_KEY: null,