parse 3.5.1-beta.1 → 4.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 +17 -4
- package/dist/parse.js +421 -347
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +421 -347
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/EventuallyQueue.js +31 -27
- package/lib/browser/LiveQueryClient.js +6 -2
- package/lib/browser/LocalDatastore.js +20 -20
- package/lib/browser/LocalDatastoreController.js +16 -14
- package/lib/browser/LocalDatastoreController.react-native.js +10 -10
- package/lib/browser/ParseCLP.js +32 -32
- package/lib/browser/ParseFile.js +26 -15
- package/lib/browser/ParseLiveQuery.js +6 -6
- package/lib/browser/ParseObject.js +84 -69
- package/lib/browser/ParseOp.js +3 -1
- package/lib/browser/ParseQuery.js +115 -88
- package/lib/browser/ParseUser.js +74 -64
- package/lib/browser/RESTController.js +6 -7
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/ObjectStateMutations.js +14 -43
- package/lib/node/ParseCLP.js +12 -41
- package/lib/node/ParseFile.js +15 -41
- package/lib/node/ParseObject.js +13 -41
- package/lib/node/ParseQuery.js +3 -1
- package/lib/node/RESTController.js +2 -43
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/LiveQueryClient.js +6 -2
- package/lib/react-native/LocalDatastore.js +3 -2
- package/lib/react-native/ParseCLP.js +32 -32
- package/lib/react-native/ParseFile.js +9 -3
- package/lib/react-native/ParseObject.js +14 -9
- package/lib/react-native/ParseOp.js +3 -1
- package/lib/react-native/ParseQuery.js +21 -7
- package/lib/react-native/RESTController.js +6 -7
- package/lib/weapp/CoreManager.js +1 -1
- package/lib/weapp/EventuallyQueue.js +31 -27
- package/lib/weapp/LiveQueryClient.js +6 -2
- package/lib/weapp/LocalDatastore.js +20 -20
- package/lib/weapp/LocalDatastoreController.js +16 -14
- package/lib/weapp/LocalDatastoreController.react-native.js +10 -10
- package/lib/weapp/ParseCLP.js +32 -32
- package/lib/weapp/ParseFile.js +26 -15
- package/lib/weapp/ParseLiveQuery.js +6 -6
- package/lib/weapp/ParseObject.js +84 -69
- package/lib/weapp/ParseOp.js +3 -1
- package/lib/weapp/ParseQuery.js +115 -88
- package/lib/weapp/ParseUser.js +74 -64
- package/lib/weapp/RESTController.js +6 -7
- package/package.json +6 -2
|
@@ -648,10 +648,12 @@ var RelationOp = function (_Op7) {
|
|
|
648
648
|
}, {
|
|
649
649
|
key: "toJSON",
|
|
650
650
|
value: function () {
|
|
651
|
+
var _this7 = this;
|
|
652
|
+
|
|
651
653
|
var idToPointer = function (id) {
|
|
652
654
|
return {
|
|
653
655
|
__type: 'Pointer',
|
|
654
|
-
className:
|
|
656
|
+
className: _this7._targetClassName,
|
|
655
657
|
objectId: id
|
|
656
658
|
};
|
|
657
659
|
};
|
|
@@ -1012,6 +1012,8 @@ var ParseQuery = function () {
|
|
|
1012
1012
|
}, {
|
|
1013
1013
|
key: "first",
|
|
1014
1014
|
value: function (options) {
|
|
1015
|
+
var _this4 = this;
|
|
1016
|
+
|
|
1015
1017
|
options = options || {};
|
|
1016
1018
|
var findOptions = {};
|
|
1017
1019
|
|
|
@@ -1053,7 +1055,7 @@ var ParseQuery = function () {
|
|
|
1053
1055
|
}
|
|
1054
1056
|
|
|
1055
1057
|
if (!objects[0].className) {
|
|
1056
|
-
objects[0].className =
|
|
1058
|
+
objects[0].className = _this4.className;
|
|
1057
1059
|
}
|
|
1058
1060
|
|
|
1059
1061
|
if (select) {
|
|
@@ -1221,6 +1223,8 @@ var ParseQuery = function () {
|
|
|
1221
1223
|
}, {
|
|
1222
1224
|
key: "map",
|
|
1223
1225
|
value: function (callback, options) {
|
|
1226
|
+
var _this5 = this;
|
|
1227
|
+
|
|
1224
1228
|
var array, index;
|
|
1225
1229
|
return _regeneratorRuntime().async(function (_context4) {
|
|
1226
1230
|
while (1) {
|
|
@@ -1230,7 +1234,7 @@ var ParseQuery = function () {
|
|
|
1230
1234
|
index = 0;
|
|
1231
1235
|
_context4.next = 4;
|
|
1232
1236
|
return _regeneratorRuntime().awrap(this.each(function (object) {
|
|
1233
|
-
return Promise.resolve(callback(object, index,
|
|
1237
|
+
return Promise.resolve(callback(object, index, _this5)).then(function (result) {
|
|
1234
1238
|
array.push(result);
|
|
1235
1239
|
index += 1;
|
|
1236
1240
|
});
|
|
@@ -1291,6 +1295,8 @@ var ParseQuery = function () {
|
|
|
1291
1295
|
}, {
|
|
1292
1296
|
key: "filter",
|
|
1293
1297
|
value: function (callback, options) {
|
|
1298
|
+
var _this6 = this;
|
|
1299
|
+
|
|
1294
1300
|
var array, index;
|
|
1295
1301
|
return _regeneratorRuntime().async(function (_context6) {
|
|
1296
1302
|
while (1) {
|
|
@@ -1300,7 +1306,7 @@ var ParseQuery = function () {
|
|
|
1300
1306
|
index = 0;
|
|
1301
1307
|
_context6.next = 4;
|
|
1302
1308
|
return _regeneratorRuntime().awrap(this.each(function (object) {
|
|
1303
|
-
return Promise.resolve(callback(object, index,
|
|
1309
|
+
return Promise.resolve(callback(object, index, _this6)).then(function (flag) {
|
|
1304
1310
|
if (flag) {
|
|
1305
1311
|
array.push(object);
|
|
1306
1312
|
}
|
|
@@ -1322,13 +1328,15 @@ var ParseQuery = function () {
|
|
|
1322
1328
|
}, {
|
|
1323
1329
|
key: "equalTo",
|
|
1324
1330
|
value: function (key, value) {
|
|
1331
|
+
var _this7 = this;
|
|
1332
|
+
|
|
1325
1333
|
if (key && typeof key === 'object') {
|
|
1326
1334
|
Object.entries(key).forEach(function (_ref) {
|
|
1327
1335
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
1328
1336
|
k = _ref2[0],
|
|
1329
1337
|
val = _ref2[1];
|
|
1330
1338
|
|
|
1331
|
-
return
|
|
1339
|
+
return _this7.equalTo(k, val);
|
|
1332
1340
|
});
|
|
1333
1341
|
return this;
|
|
1334
1342
|
}
|
|
@@ -1343,13 +1351,15 @@ var ParseQuery = function () {
|
|
|
1343
1351
|
}, {
|
|
1344
1352
|
key: "notEqualTo",
|
|
1345
1353
|
value: function (key, value) {
|
|
1354
|
+
var _this8 = this;
|
|
1355
|
+
|
|
1346
1356
|
if (key && typeof key === 'object') {
|
|
1347
1357
|
Object.entries(key).forEach(function (_ref3) {
|
|
1348
1358
|
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
|
1349
1359
|
k = _ref4[0],
|
|
1350
1360
|
val = _ref4[1];
|
|
1351
1361
|
|
|
1352
|
-
return
|
|
1362
|
+
return _this8.notEqualTo(k, val);
|
|
1353
1363
|
});
|
|
1354
1364
|
return this;
|
|
1355
1365
|
}
|
|
@@ -1399,13 +1409,15 @@ var ParseQuery = function () {
|
|
|
1399
1409
|
}, {
|
|
1400
1410
|
key: "containsAllStartingWith",
|
|
1401
1411
|
value: function (key, values) {
|
|
1412
|
+
var _this = this;
|
|
1413
|
+
|
|
1402
1414
|
if (!Array.isArray(values)) {
|
|
1403
1415
|
values = [values];
|
|
1404
1416
|
}
|
|
1405
1417
|
|
|
1406
1418
|
var regexObject = values.map(function (value) {
|
|
1407
1419
|
return {
|
|
1408
|
-
$regex:
|
|
1420
|
+
$regex: _this._regexStartWith(value)
|
|
1409
1421
|
};
|
|
1410
1422
|
});
|
|
1411
1423
|
return this.containsAll(key, regexObject);
|
|
@@ -1859,6 +1871,8 @@ var ParseQuery = function () {
|
|
|
1859
1871
|
}, {
|
|
1860
1872
|
key: "cancel",
|
|
1861
1873
|
value: function () {
|
|
1874
|
+
var _this14 = this;
|
|
1875
|
+
|
|
1862
1876
|
if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {
|
|
1863
1877
|
this._xhrRequest.task._aborted = true;
|
|
1864
1878
|
|
|
@@ -1872,7 +1886,7 @@ var ParseQuery = function () {
|
|
|
1872
1886
|
}
|
|
1873
1887
|
|
|
1874
1888
|
return this._xhrRequest.onchange = function () {
|
|
1875
|
-
return
|
|
1889
|
+
return _this14.cancel();
|
|
1876
1890
|
};
|
|
1877
1891
|
}
|
|
1878
1892
|
}, {
|
|
@@ -104,7 +104,7 @@ var RESTController = {
|
|
|
104
104
|
var requestId = isIdempotent ? uuidv4() : '';
|
|
105
105
|
var attempts = 0;
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
(function dispatch() {
|
|
108
108
|
if (XHR == null) {
|
|
109
109
|
throw new Error('Cannot make a request: No definition of XMLHttpRequest was found.');
|
|
110
110
|
}
|
|
@@ -228,12 +228,11 @@ var RESTController = {
|
|
|
228
228
|
if (options && typeof options.requestTask === 'function') {
|
|
229
229
|
options.requestTask(xhr);
|
|
230
230
|
}
|
|
231
|
-
};
|
|
231
|
+
})();
|
|
232
232
|
|
|
233
|
-
dispatch();
|
|
234
233
|
return promise;
|
|
235
234
|
},
|
|
236
|
-
request: function (method, path, data, options) {
|
|
235
|
+
request: function request(method, path, data, options) {
|
|
237
236
|
options = options || {};
|
|
238
237
|
|
|
239
238
|
var url = _CoreManager.default.get('SERVER_URL');
|
|
@@ -339,7 +338,7 @@ var RESTController = {
|
|
|
339
338
|
});
|
|
340
339
|
}).catch(RESTController.handleError);
|
|
341
340
|
},
|
|
342
|
-
handleError: function (response) {
|
|
341
|
+
handleError: function handleError(response) {
|
|
343
342
|
var error;
|
|
344
343
|
|
|
345
344
|
if (response && response.responseText) {
|
|
@@ -356,10 +355,10 @@ var RESTController = {
|
|
|
356
355
|
|
|
357
356
|
return Promise.reject(error);
|
|
358
357
|
},
|
|
359
|
-
_setXHR: function (xhr) {
|
|
358
|
+
_setXHR: function _setXHR(xhr) {
|
|
360
359
|
XHR = xhr;
|
|
361
360
|
},
|
|
362
|
-
_getXHR: function () {
|
|
361
|
+
_getXHR: function _getXHR() {
|
|
363
362
|
return XHR;
|
|
364
363
|
}
|
|
365
364
|
};
|
package/lib/weapp/CoreManager.js
CHANGED
|
@@ -509,7 +509,7 @@ var EventuallyQueue = {
|
|
|
509
509
|
|
|
510
510
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
511
511
|
var queueData, queueId, index, prop;
|
|
512
|
-
return _regeneratorRuntime().wrap(function (_context) {
|
|
512
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
513
513
|
while (1) {
|
|
514
514
|
switch (_context.prev = _context.next) {
|
|
515
515
|
case 0:
|
|
@@ -552,10 +552,10 @@ var EventuallyQueue = {
|
|
|
552
552
|
}, _callee);
|
|
553
553
|
}))();
|
|
554
554
|
},
|
|
555
|
-
store: function (data) {
|
|
555
|
+
store: function store(data) {
|
|
556
556
|
return _Storage.default.setItemAsync(QUEUE_KEY, (0, _stringify.default)(data));
|
|
557
557
|
},
|
|
558
|
-
load: function () {
|
|
558
|
+
load: function load() {
|
|
559
559
|
return _Storage.default.getItemAsync(QUEUE_KEY);
|
|
560
560
|
},
|
|
561
561
|
|
|
@@ -567,11 +567,13 @@ var EventuallyQueue = {
|
|
|
567
567
|
* @returns {Promise<Array>}
|
|
568
568
|
* @static
|
|
569
569
|
*/
|
|
570
|
-
getQueue: function ()
|
|
570
|
+
getQueue: function getQueue()
|
|
571
571
|
/*: Promise<Array>*/
|
|
572
572
|
{
|
|
573
|
+
var _this2 = this;
|
|
574
|
+
|
|
573
575
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
574
|
-
return _regeneratorRuntime().wrap(function (_context2) {
|
|
576
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
575
577
|
while (1) {
|
|
576
578
|
switch (_context2.prev = _context2.next) {
|
|
577
579
|
case 0:
|
|
@@ -582,7 +584,7 @@ var EventuallyQueue = {
|
|
|
582
584
|
|
|
583
585
|
_context2.t0 = JSON;
|
|
584
586
|
_context2.next = 4;
|
|
585
|
-
return
|
|
587
|
+
return _this2.load();
|
|
586
588
|
|
|
587
589
|
case 4:
|
|
588
590
|
_context2.t1 = _context2.sent;
|
|
@@ -619,7 +621,7 @@ var EventuallyQueue = {
|
|
|
619
621
|
* @static
|
|
620
622
|
* @ignore
|
|
621
623
|
*/
|
|
622
|
-
setQueue: function (queue
|
|
624
|
+
setQueue: function setQueue(queue
|
|
623
625
|
/*: Queue*/
|
|
624
626
|
)
|
|
625
627
|
/*: Promise<void>*/
|
|
@@ -636,7 +638,7 @@ var EventuallyQueue = {
|
|
|
636
638
|
* @static
|
|
637
639
|
* @ignore
|
|
638
640
|
*/
|
|
639
|
-
remove: function (queueId
|
|
641
|
+
remove: function remove(queueId
|
|
640
642
|
/*: string*/
|
|
641
643
|
)
|
|
642
644
|
/*: Promise<void>*/
|
|
@@ -645,7 +647,7 @@ var EventuallyQueue = {
|
|
|
645
647
|
|
|
646
648
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
647
649
|
var queueData, index;
|
|
648
|
-
return _regeneratorRuntime().wrap(function (_context3) {
|
|
650
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
649
651
|
while (1) {
|
|
650
652
|
switch (_context3.prev = _context3.next) {
|
|
651
653
|
case 0:
|
|
@@ -682,7 +684,7 @@ var EventuallyQueue = {
|
|
|
682
684
|
* @returns {Promise} A promise that is fulfilled when queue is cleared.
|
|
683
685
|
* @static
|
|
684
686
|
*/
|
|
685
|
-
clear: function ()
|
|
687
|
+
clear: function clear()
|
|
686
688
|
/*: Promise*/
|
|
687
689
|
{
|
|
688
690
|
queueCache = [];
|
|
@@ -698,7 +700,7 @@ var EventuallyQueue = {
|
|
|
698
700
|
* @static
|
|
699
701
|
* @ignore
|
|
700
702
|
*/
|
|
701
|
-
queueItemExists: function (queue
|
|
703
|
+
queueItemExists: function queueItemExists(queue
|
|
702
704
|
/*: Queue*/
|
|
703
705
|
, queueId
|
|
704
706
|
/*: string*/
|
|
@@ -718,17 +720,19 @@ var EventuallyQueue = {
|
|
|
718
720
|
* @returns {number}
|
|
719
721
|
* @static
|
|
720
722
|
*/
|
|
721
|
-
length: function ()
|
|
723
|
+
length: function length()
|
|
722
724
|
/*: number*/
|
|
723
725
|
{
|
|
726
|
+
var _this4 = this;
|
|
727
|
+
|
|
724
728
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
725
729
|
var queueData;
|
|
726
|
-
return _regeneratorRuntime().wrap(function (_context4) {
|
|
730
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
727
731
|
while (1) {
|
|
728
732
|
switch (_context4.prev = _context4.next) {
|
|
729
733
|
case 0:
|
|
730
734
|
_context4.next = 2;
|
|
731
|
-
return
|
|
735
|
+
return _this4.getQueue();
|
|
732
736
|
|
|
733
737
|
case 2:
|
|
734
738
|
queueData = _context4.sent;
|
|
@@ -751,14 +755,14 @@ var EventuallyQueue = {
|
|
|
751
755
|
* @returns {Promise<boolean>} Returns true if queue was sent successfully.
|
|
752
756
|
* @static
|
|
753
757
|
*/
|
|
754
|
-
sendQueue: function ()
|
|
758
|
+
sendQueue: function sendQueue()
|
|
755
759
|
/*: Promise<boolean>*/
|
|
756
760
|
{
|
|
757
761
|
var _this5 = this;
|
|
758
762
|
|
|
759
763
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
760
764
|
var queue, queueData, i, queueObject, id, hash, className, ObjectType;
|
|
761
|
-
return _regeneratorRuntime().wrap(function (_context5) {
|
|
765
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
762
766
|
while (1) {
|
|
763
767
|
switch (_context5.prev = _context5.next) {
|
|
764
768
|
case 0:
|
|
@@ -844,7 +848,7 @@ var EventuallyQueue = {
|
|
|
844
848
|
* @static
|
|
845
849
|
* @ignore
|
|
846
850
|
*/
|
|
847
|
-
sendQueueCallback: function (object
|
|
851
|
+
sendQueueCallback: function sendQueueCallback(object
|
|
848
852
|
/*: ParseObject*/
|
|
849
853
|
, queueObject
|
|
850
854
|
/*: QueueObject*/
|
|
@@ -854,7 +858,7 @@ var EventuallyQueue = {
|
|
|
854
858
|
var _this6 = this;
|
|
855
859
|
|
|
856
860
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
857
|
-
return _regeneratorRuntime().wrap(function (_context6) {
|
|
861
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
858
862
|
while (1) {
|
|
859
863
|
switch (_context6.prev = _context6.next) {
|
|
860
864
|
case 0:
|
|
@@ -952,7 +956,7 @@ var EventuallyQueue = {
|
|
|
952
956
|
* @param [ms] Milliseconds to ping the server. Default 2000ms
|
|
953
957
|
* @static
|
|
954
958
|
*/
|
|
955
|
-
poll: function () {
|
|
959
|
+
poll: function poll() {
|
|
956
960
|
var _this7 = this;
|
|
957
961
|
|
|
958
962
|
var ms
|
|
@@ -987,7 +991,7 @@ var EventuallyQueue = {
|
|
|
987
991
|
* @name Parse.EventuallyQueue.stopPoll
|
|
988
992
|
* @static
|
|
989
993
|
*/
|
|
990
|
-
stopPoll: function () {
|
|
994
|
+
stopPoll: function stopPoll() {
|
|
991
995
|
clearInterval(polling);
|
|
992
996
|
polling = undefined;
|
|
993
997
|
},
|
|
@@ -1000,25 +1004,25 @@ var EventuallyQueue = {
|
|
|
1000
1004
|
* @returns {boolean}
|
|
1001
1005
|
* @static
|
|
1002
1006
|
*/
|
|
1003
|
-
isPolling: function ()
|
|
1007
|
+
isPolling: function isPolling()
|
|
1004
1008
|
/*: boolean*/
|
|
1005
1009
|
{
|
|
1006
1010
|
return !!polling;
|
|
1007
1011
|
},
|
|
1008
|
-
_setPolling: function (flag
|
|
1012
|
+
_setPolling: function _setPolling(flag
|
|
1009
1013
|
/*: boolean*/
|
|
1010
1014
|
) {
|
|
1011
1015
|
polling = flag;
|
|
1012
1016
|
},
|
|
1013
1017
|
process: {
|
|
1014
|
-
create: function (ObjectType, queueObject) {
|
|
1018
|
+
create: function create(ObjectType, queueObject) {
|
|
1015
1019
|
var object = new ObjectType();
|
|
1016
1020
|
return EventuallyQueue.sendQueueCallback(object, queueObject);
|
|
1017
1021
|
},
|
|
1018
|
-
byId: function (ObjectType, queueObject) {
|
|
1022
|
+
byId: function byId(ObjectType, queueObject) {
|
|
1019
1023
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
1020
1024
|
var sessionToken, query, results;
|
|
1021
|
-
return _regeneratorRuntime().wrap(function (_context7) {
|
|
1025
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
1022
1026
|
while (1) {
|
|
1023
1027
|
switch (_context7.prev = _context7.next) {
|
|
1024
1028
|
case 0:
|
|
@@ -1042,10 +1046,10 @@ var EventuallyQueue = {
|
|
|
1042
1046
|
}, _callee7);
|
|
1043
1047
|
}))();
|
|
1044
1048
|
},
|
|
1045
|
-
byHash: function (ObjectType, queueObject) {
|
|
1049
|
+
byHash: function byHash(ObjectType, queueObject) {
|
|
1046
1050
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
1047
1051
|
var sessionToken, query, results;
|
|
1048
|
-
return _regeneratorRuntime().wrap(function (_context8) {
|
|
1052
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
1049
1053
|
while (1) {
|
|
1050
1054
|
switch (_context8.prev = _context8.next) {
|
|
1051
1055
|
case 0:
|
|
@@ -367,6 +367,8 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
367
367
|
)
|
|
368
368
|
/*: LiveQuerySubscription*/
|
|
369
369
|
{
|
|
370
|
+
var _this2 = this;
|
|
371
|
+
|
|
370
372
|
if (!query) {
|
|
371
373
|
return;
|
|
372
374
|
}
|
|
@@ -393,7 +395,7 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
393
395
|
this.subscriptions.set(this.requestId, subscription);
|
|
394
396
|
this.requestId += 1;
|
|
395
397
|
this.connectPromise.then(function () {
|
|
396
|
-
|
|
398
|
+
_this2.socket.send((0, _stringify.default)(subscribeRequest));
|
|
397
399
|
});
|
|
398
400
|
return subscription;
|
|
399
401
|
}
|
|
@@ -408,6 +410,8 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
408
410
|
value: function (subscription
|
|
409
411
|
/*: Object*/
|
|
410
412
|
) {
|
|
413
|
+
var _this3 = this;
|
|
414
|
+
|
|
411
415
|
if (!subscription) {
|
|
412
416
|
return;
|
|
413
417
|
}
|
|
@@ -418,7 +422,7 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
418
422
|
requestId: subscription.id
|
|
419
423
|
};
|
|
420
424
|
this.connectPromise.then(function () {
|
|
421
|
-
|
|
425
|
+
_this3.socket.send((0, _stringify.default)(unsubscribeRequest));
|
|
422
426
|
});
|
|
423
427
|
}
|
|
424
428
|
/**
|
|
@@ -595,7 +595,7 @@ var LocalDatastore = {
|
|
|
595
595
|
|
|
596
596
|
var pinName, toPinPromises, objectKeys, _iterator, _step, parent, children, parentKey, json, objectKey, fromPinPromise, _yield$Promise$all, _yield$Promise$all2, pinned, toPin;
|
|
597
597
|
|
|
598
|
-
return _regeneratorRuntime().wrap(function (_context2) {
|
|
598
|
+
return _regeneratorRuntime().wrap(function _callee$(_context2) {
|
|
599
599
|
while (1) {
|
|
600
600
|
switch (_context2.prev = _context2.next) {
|
|
601
601
|
case 0:
|
|
@@ -649,7 +649,7 @@ var LocalDatastore = {
|
|
|
649
649
|
},
|
|
650
650
|
// Removes object and children keys from pin name
|
|
651
651
|
// Keeps the object and children pinned
|
|
652
|
-
_handleUnPinAllWithName: function (name
|
|
652
|
+
_handleUnPinAllWithName: function _handleUnPinAllWithName(name
|
|
653
653
|
/*: string*/
|
|
654
654
|
, objects
|
|
655
655
|
/*: Array<ParseObject>*/
|
|
@@ -659,7 +659,7 @@ var LocalDatastore = {
|
|
|
659
659
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
660
660
|
var localDatastore, pinName, promises, objectKeys, _iterator2, _step2, _objectKeys, _context3, parent, children, parentKey, pinned, _iterator3, _step3, objectKey, hasReference, key, pinnedObjects;
|
|
661
661
|
|
|
662
|
-
return _regeneratorRuntime().wrap(function (_context4) {
|
|
662
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context4) {
|
|
663
663
|
while (1) {
|
|
664
664
|
switch (_context4.prev = _context4.next) {
|
|
665
665
|
case 0:
|
|
@@ -781,7 +781,7 @@ var LocalDatastore = {
|
|
|
781
781
|
}))();
|
|
782
782
|
},
|
|
783
783
|
// Retrieve all pointer fields from object recursively
|
|
784
|
-
_getChildren: function (object
|
|
784
|
+
_getChildren: function _getChildren(object
|
|
785
785
|
/*: ParseObject*/
|
|
786
786
|
) {
|
|
787
787
|
var encountered = {};
|
|
@@ -796,7 +796,7 @@ var LocalDatastore = {
|
|
|
796
796
|
|
|
797
797
|
return encountered;
|
|
798
798
|
},
|
|
799
|
-
_traverse: function (object
|
|
799
|
+
_traverse: function _traverse(object
|
|
800
800
|
/*: any*/
|
|
801
801
|
, encountered
|
|
802
802
|
/*: any*/
|
|
@@ -826,7 +826,7 @@ var LocalDatastore = {
|
|
|
826
826
|
}
|
|
827
827
|
},
|
|
828
828
|
// Transform keys in pin name to objects
|
|
829
|
-
_serializeObjectsFromPinName: function (name
|
|
829
|
+
_serializeObjectsFromPinName: function _serializeObjectsFromPinName(name
|
|
830
830
|
/*: string*/
|
|
831
831
|
) {
|
|
832
832
|
var _this3 = this;
|
|
@@ -835,7 +835,7 @@ var LocalDatastore = {
|
|
|
835
835
|
var _context5, _concatInstanceProper, _context6;
|
|
836
836
|
|
|
837
837
|
var localDatastore, allObjects, key, pinName, pinned, promises, objects;
|
|
838
|
-
return _regeneratorRuntime().wrap(function (_context7) {
|
|
838
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context7) {
|
|
839
839
|
while (1) {
|
|
840
840
|
switch (_context7.prev = _context7.next) {
|
|
841
841
|
case 0:
|
|
@@ -895,7 +895,7 @@ var LocalDatastore = {
|
|
|
895
895
|
// Replaces object pointers with pinned pointers
|
|
896
896
|
// The object pointers may contain old data
|
|
897
897
|
// Uses Breadth First Search Algorithm
|
|
898
|
-
_serializeObject: function (objectKey
|
|
898
|
+
_serializeObject: function _serializeObject(objectKey
|
|
899
899
|
/*: string*/
|
|
900
900
|
, localDatastore
|
|
901
901
|
/*: any*/
|
|
@@ -904,7 +904,7 @@ var LocalDatastore = {
|
|
|
904
904
|
|
|
905
905
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
906
906
|
var LDS, root, queue, meta, uniqueId, nodeId, subTreeRoot, field, value, key, pointer;
|
|
907
|
-
return _regeneratorRuntime().wrap(function (_context8) {
|
|
907
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context8) {
|
|
908
908
|
while (1) {
|
|
909
909
|
switch (_context8.prev = _context8.next) {
|
|
910
910
|
case 0:
|
|
@@ -970,7 +970,7 @@ var LocalDatastore = {
|
|
|
970
970
|
},
|
|
971
971
|
// Called when an object is save / fetched
|
|
972
972
|
// Update object pin value
|
|
973
|
-
_updateObjectIfPinned: function (object
|
|
973
|
+
_updateObjectIfPinned: function _updateObjectIfPinned(object
|
|
974
974
|
/*: ParseObject*/
|
|
975
975
|
)
|
|
976
976
|
/*: Promise<void>*/
|
|
@@ -979,7 +979,7 @@ var LocalDatastore = {
|
|
|
979
979
|
|
|
980
980
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
981
981
|
var objectKey, pinned;
|
|
982
|
-
return _regeneratorRuntime().wrap(function (_context9) {
|
|
982
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context9) {
|
|
983
983
|
while (1) {
|
|
984
984
|
switch (_context9.prev = _context9.next) {
|
|
985
985
|
case 0:
|
|
@@ -1019,14 +1019,14 @@ var LocalDatastore = {
|
|
|
1019
1019
|
// Called when object is destroyed
|
|
1020
1020
|
// Unpin object and remove all references from pin names
|
|
1021
1021
|
// TODO: Destroy children?
|
|
1022
|
-
_destroyObjectIfPinned: function (object
|
|
1022
|
+
_destroyObjectIfPinned: function _destroyObjectIfPinned(object
|
|
1023
1023
|
/*: ParseObject*/
|
|
1024
1024
|
) {
|
|
1025
1025
|
var _this6 = this;
|
|
1026
1026
|
|
|
1027
1027
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
1028
1028
|
var localDatastore, objectKey, pin, promises, key, pinned;
|
|
1029
|
-
return _regeneratorRuntime().wrap(function (_context10) {
|
|
1029
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context10) {
|
|
1030
1030
|
while (1) {
|
|
1031
1031
|
switch (_context10.prev = _context10.next) {
|
|
1032
1032
|
case 0:
|
|
@@ -1088,7 +1088,7 @@ var LocalDatastore = {
|
|
|
1088
1088
|
}))();
|
|
1089
1089
|
},
|
|
1090
1090
|
// Update pin and references of the unsaved object
|
|
1091
|
-
_updateLocalIdForObject: function (localId
|
|
1091
|
+
_updateLocalIdForObject: function _updateLocalIdForObject(localId
|
|
1092
1092
|
/*: string*/
|
|
1093
1093
|
, object
|
|
1094
1094
|
/*: ParseObject*/
|
|
@@ -1099,7 +1099,7 @@ var LocalDatastore = {
|
|
|
1099
1099
|
var _context11, _context12;
|
|
1100
1100
|
|
|
1101
1101
|
var localKey, objectKey, unsaved, promises, localDatastore, key, pinned;
|
|
1102
|
-
return _regeneratorRuntime().wrap(function (_context13) {
|
|
1102
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context13) {
|
|
1103
1103
|
while (1) {
|
|
1104
1104
|
switch (_context13.prev = _context13.next) {
|
|
1105
1105
|
case 0:
|
|
@@ -1171,7 +1171,7 @@ var LocalDatastore = {
|
|
|
1171
1171
|
* @name Parse.LocalDatastore.updateFromServer
|
|
1172
1172
|
* @static
|
|
1173
1173
|
*/
|
|
1174
|
-
updateFromServer: function () {
|
|
1174
|
+
updateFromServer: function updateFromServer() {
|
|
1175
1175
|
var _this8 = this;
|
|
1176
1176
|
|
|
1177
1177
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
@@ -1179,7 +1179,7 @@ var LocalDatastore = {
|
|
|
1179
1179
|
|
|
1180
1180
|
var localDatastore, keys, key, pointersHash, _i, _keys, _key, _key$split, _key$split2, className, objectId, queryPromises, responses, objects, pinPromises;
|
|
1181
1181
|
|
|
1182
|
-
return _regeneratorRuntime().wrap(function (_context15) {
|
|
1182
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context15) {
|
|
1183
1183
|
while (1) {
|
|
1184
1184
|
switch (_context15.prev = _context15.next) {
|
|
1185
1185
|
case 0:
|
|
@@ -1298,7 +1298,7 @@ var LocalDatastore = {
|
|
|
1298
1298
|
}, _callee8, null, [[24, 35]]);
|
|
1299
1299
|
}))();
|
|
1300
1300
|
},
|
|
1301
|
-
getKeyForObject: function (object
|
|
1301
|
+
getKeyForObject: function getKeyForObject(object
|
|
1302
1302
|
/*: any*/
|
|
1303
1303
|
) {
|
|
1304
1304
|
var _context16, _context17;
|
|
@@ -1307,7 +1307,7 @@ var LocalDatastore = {
|
|
|
1307
1307
|
|
|
1308
1308
|
return (0, _concat.default)(_context16 = (0, _concat.default)(_context17 = "".concat(_LocalDatastoreUtils.OBJECT_PREFIX)).call(_context17, object.className, "_")).call(_context16, objectId);
|
|
1309
1309
|
},
|
|
1310
|
-
getPinName: function (pinName
|
|
1310
|
+
getPinName: function getPinName(pinName
|
|
1311
1311
|
/*: ?string*/
|
|
1312
1312
|
) {
|
|
1313
1313
|
if (!pinName || pinName === _LocalDatastoreUtils.DEFAULT_PIN) {
|
|
@@ -1316,7 +1316,7 @@ var LocalDatastore = {
|
|
|
1316
1316
|
|
|
1317
1317
|
return _LocalDatastoreUtils.PIN_PREFIX + pinName;
|
|
1318
1318
|
},
|
|
1319
|
-
checkIfEnabled: function () {
|
|
1319
|
+
checkIfEnabled: function checkIfEnabled() {
|
|
1320
1320
|
if (!this.isEnabled) {
|
|
1321
1321
|
console.error('Parse.enableLocalDatastore() must be called first');
|
|
1322
1322
|
}
|