parse 4.1.0-alpha.1 → 4.1.0-alpha.3
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 +63 -24
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +63 -24
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/LiveQueryClient.js +7 -3
- package/lib/browser/ParseFile.js +1 -0
- package/lib/browser/ParseQuery.js +53 -19
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/LiveQueryClient.js +5 -2
- package/lib/node/ParseFile.js +1 -0
- package/lib/node/ParseQuery.js +27 -0
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/LiveQueryClient.js +7 -3
- package/lib/react-native/ParseFile.js +1 -0
- package/lib/react-native/ParseQuery.js +34 -11
- package/lib/weapp/CoreManager.js +1 -1
- package/lib/weapp/LiveQueryClient.js +7 -3
- package/lib/weapp/ParseFile.js +1 -0
- package/lib/weapp/ParseQuery.js +53 -19
- package/package.json +15 -15
package/dist/parse.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Parse JavaScript SDK v4.1.0-alpha.
|
|
2
|
+
* Parse JavaScript SDK v4.1.0-alpha.3
|
|
3
3
|
*
|
|
4
4
|
* The source tree of this library can be found at
|
|
5
5
|
* https://github.com/ParsePlatform/Parse-SDK-JS
|
|
@@ -531,7 +531,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
|
|
|
531
531
|
SERVER_AUTH_TOKEN: null,
|
|
532
532
|
LIVEQUERY_SERVER_URL: null,
|
|
533
533
|
ENCRYPTED_KEY: null,
|
|
534
|
-
VERSION: 'js' + "4.1.0-alpha.
|
|
534
|
+
VERSION: 'js' + "4.1.0-alpha.3",
|
|
535
535
|
APPLICATION_ID: null,
|
|
536
536
|
JAVASCRIPT_KEY: null,
|
|
537
537
|
MASTER_KEY: null,
|
|
@@ -1888,21 +1888,25 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1888
1888
|
}, {
|
|
1889
1889
|
key: "subscribe",
|
|
1890
1890
|
value: function (query /*: Object*/, sessionToken /*: ?string*/) /*: LiveQuerySubscription*/{
|
|
1891
|
-
var
|
|
1891
|
+
var _queryJSON$keys,
|
|
1892
|
+
_queryJSON$watch,
|
|
1893
|
+
_this2 = this;
|
|
1892
1894
|
if (!query) {
|
|
1893
1895
|
return;
|
|
1894
1896
|
}
|
|
1895
1897
|
var className = query.className;
|
|
1896
1898
|
var queryJSON = query.toJSON();
|
|
1897
1899
|
var where = queryJSON.where;
|
|
1898
|
-
var fields = (0, _keys.default)(queryJSON) ?
|
|
1900
|
+
var fields = (_queryJSON$keys = (0, _keys.default)(queryJSON)) === null || _queryJSON$keys === void 0 ? void 0 : _queryJSON$keys.split(',');
|
|
1901
|
+
var watch = (_queryJSON$watch = queryJSON.watch) === null || _queryJSON$watch === void 0 ? void 0 : _queryJSON$watch.split(',');
|
|
1899
1902
|
var subscribeRequest = {
|
|
1900
1903
|
op: OP_TYPES.SUBSCRIBE,
|
|
1901
1904
|
requestId: this.requestId,
|
|
1902
1905
|
query: {
|
|
1903
1906
|
className: className,
|
|
1904
1907
|
where: where,
|
|
1905
|
-
fields: fields
|
|
1908
|
+
fields: fields,
|
|
1909
|
+
watch: watch
|
|
1906
1910
|
}
|
|
1907
1911
|
};
|
|
1908
1912
|
if (sessionToken) {
|
|
@@ -6922,6 +6926,7 @@ var ParseFile = /*#__PURE__*/function () {
|
|
|
6922
6926
|
key: "cancel",
|
|
6923
6927
|
value: function () {
|
|
6924
6928
|
if (this._requestTask && typeof this._requestTask.abort === 'function') {
|
|
6929
|
+
this._requestTask._aborted = true;
|
|
6925
6930
|
this._requestTask.abort();
|
|
6926
6931
|
}
|
|
6927
6932
|
this._requestTask = null;
|
|
@@ -11675,6 +11680,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
11675
11680
|
(0, _classCallCheck2.default)(this, ParseQuery);
|
|
11676
11681
|
(0, _defineProperty2.default)(this, "className", void 0);
|
|
11677
11682
|
(0, _defineProperty2.default)(this, "_where", void 0);
|
|
11683
|
+
(0, _defineProperty2.default)(this, "_watch", void 0);
|
|
11678
11684
|
(0, _defineProperty2.default)(this, "_include", void 0);
|
|
11679
11685
|
(0, _defineProperty2.default)(this, "_exclude", void 0);
|
|
11680
11686
|
(0, _defineProperty2.default)(this, "_select", void 0);
|
|
@@ -11710,6 +11716,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
11710
11716
|
throw new TypeError('A ParseQuery must be constructed with a ParseObject or class name.');
|
|
11711
11717
|
}
|
|
11712
11718
|
this._where = {};
|
|
11719
|
+
this._watch = [];
|
|
11713
11720
|
this._include = [];
|
|
11714
11721
|
this._exclude = [];
|
|
11715
11722
|
this._count = false;
|
|
@@ -11902,6 +11909,9 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
11902
11909
|
var params /*: QueryJSON*/ = {
|
|
11903
11910
|
where: this._where
|
|
11904
11911
|
};
|
|
11912
|
+
if (this._watch.length) {
|
|
11913
|
+
params.watch = this._watch.join(',');
|
|
11914
|
+
}
|
|
11905
11915
|
if (this._include.length) {
|
|
11906
11916
|
params.include = this._include.join(',');
|
|
11907
11917
|
}
|
|
@@ -11971,6 +11981,9 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
11971
11981
|
if (json.where) {
|
|
11972
11982
|
this._where = json.where;
|
|
11973
11983
|
}
|
|
11984
|
+
if (json.watch) {
|
|
11985
|
+
this._watch = json.watch.split(',');
|
|
11986
|
+
}
|
|
11974
11987
|
if (json.include) {
|
|
11975
11988
|
this._include = json.include.split(',');
|
|
11976
11989
|
}
|
|
@@ -13560,6 +13573,32 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
13560
13573
|
return this;
|
|
13561
13574
|
}
|
|
13562
13575
|
|
|
13576
|
+
/**
|
|
13577
|
+
* Restricts live query to trigger only for watched fields.
|
|
13578
|
+
*
|
|
13579
|
+
* Requires Parse Server 6.0.0+
|
|
13580
|
+
*
|
|
13581
|
+
* @param {...string|Array<string>} keys The name(s) of the key(s) to watch.
|
|
13582
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
13583
|
+
*/
|
|
13584
|
+
}, {
|
|
13585
|
+
key: "watch",
|
|
13586
|
+
value: function () /*: ParseQuery*/{
|
|
13587
|
+
var _this14 = this;
|
|
13588
|
+
for (var _len8 = arguments.length, keys = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
|
|
13589
|
+
keys[_key12] = arguments[_key12];
|
|
13590
|
+
}
|
|
13591
|
+
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
13592
|
+
if ((0, _isArray.default)(key)) {
|
|
13593
|
+
var _context22;
|
|
13594
|
+
_this14._watch = (0, _concat.default)(_context22 = _this14._watch).call(_context22, key);
|
|
13595
|
+
} else {
|
|
13596
|
+
_this14._watch.push(key);
|
|
13597
|
+
}
|
|
13598
|
+
});
|
|
13599
|
+
return this;
|
|
13600
|
+
}
|
|
13601
|
+
|
|
13563
13602
|
/**
|
|
13564
13603
|
* Changes the read preference that the backend will use when performing the query to the database.
|
|
13565
13604
|
*
|
|
@@ -13589,30 +13628,30 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
13589
13628
|
value: function () {
|
|
13590
13629
|
var _subscribe = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(sessionToken /*:: ?: string*/) {
|
|
13591
13630
|
var currentUser, liveQueryClient, subscription;
|
|
13592
|
-
return _regenerator.default.wrap(function (
|
|
13593
|
-
while (1) switch (
|
|
13631
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
13632
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
13594
13633
|
case 0:
|
|
13595
|
-
|
|
13634
|
+
_context23.next = 2;
|
|
13596
13635
|
return _CoreManager.default.getUserController().currentUserAsync();
|
|
13597
13636
|
case 2:
|
|
13598
|
-
currentUser =
|
|
13637
|
+
currentUser = _context23.sent;
|
|
13599
13638
|
if (!sessionToken) {
|
|
13600
13639
|
sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
|
|
13601
13640
|
}
|
|
13602
|
-
|
|
13641
|
+
_context23.next = 6;
|
|
13603
13642
|
return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
|
|
13604
13643
|
case 6:
|
|
13605
|
-
liveQueryClient =
|
|
13644
|
+
liveQueryClient = _context23.sent;
|
|
13606
13645
|
if (liveQueryClient.shouldOpen()) {
|
|
13607
13646
|
liveQueryClient.open();
|
|
13608
13647
|
}
|
|
13609
13648
|
subscription = liveQueryClient.subscribe(this, sessionToken);
|
|
13610
|
-
return
|
|
13649
|
+
return _context23.abrupt("return", subscription.subscribePromise.then(function () {
|
|
13611
13650
|
return subscription;
|
|
13612
13651
|
}));
|
|
13613
13652
|
case 10:
|
|
13614
13653
|
case "end":
|
|
13615
|
-
return
|
|
13654
|
+
return _context23.stop();
|
|
13616
13655
|
}
|
|
13617
13656
|
}, _callee7, this);
|
|
13618
13657
|
}));
|
|
@@ -13694,7 +13733,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
13694
13733
|
}, {
|
|
13695
13734
|
key: "cancel",
|
|
13696
13735
|
value: function () /*: ParseQuery*/{
|
|
13697
|
-
var
|
|
13736
|
+
var _this15 = this;
|
|
13698
13737
|
if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {
|
|
13699
13738
|
this._xhrRequest.task._aborted = true;
|
|
13700
13739
|
this._xhrRequest.task.abort();
|
|
@@ -13703,16 +13742,16 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
13703
13742
|
return this;
|
|
13704
13743
|
}
|
|
13705
13744
|
return this._xhrRequest.onchange = function () {
|
|
13706
|
-
return
|
|
13745
|
+
return _this15.cancel();
|
|
13707
13746
|
};
|
|
13708
13747
|
}
|
|
13709
13748
|
}, {
|
|
13710
13749
|
key: "_setRequestTask",
|
|
13711
13750
|
value: function (options) {
|
|
13712
|
-
var
|
|
13751
|
+
var _this16 = this;
|
|
13713
13752
|
options.requestTask = function (task) {
|
|
13714
|
-
|
|
13715
|
-
|
|
13753
|
+
_this16._xhrRequest.task = task;
|
|
13754
|
+
_this16._xhrRequest.onchange();
|
|
13716
13755
|
};
|
|
13717
13756
|
}
|
|
13718
13757
|
}], [{
|
|
@@ -13724,8 +13763,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
13724
13763
|
}, {
|
|
13725
13764
|
key: "or",
|
|
13726
13765
|
value: function () /*: ParseQuery*/{
|
|
13727
|
-
for (var
|
|
13728
|
-
queries[
|
|
13766
|
+
for (var _len9 = arguments.length, queries = new Array(_len9), _key13 = 0; _key13 < _len9; _key13++) {
|
|
13767
|
+
queries[_key13] = arguments[_key13];
|
|
13729
13768
|
}
|
|
13730
13769
|
var className = _getClassNameFromQueries(queries);
|
|
13731
13770
|
var query = new ParseQuery(className);
|
|
@@ -13748,8 +13787,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
13748
13787
|
}, {
|
|
13749
13788
|
key: "and",
|
|
13750
13789
|
value: function () /*: ParseQuery*/{
|
|
13751
|
-
for (var
|
|
13752
|
-
queries[
|
|
13790
|
+
for (var _len10 = arguments.length, queries = new Array(_len10), _key14 = 0; _key14 < _len10; _key14++) {
|
|
13791
|
+
queries[_key14] = arguments[_key14];
|
|
13753
13792
|
}
|
|
13754
13793
|
var className = _getClassNameFromQueries(queries);
|
|
13755
13794
|
var query = new ParseQuery(className);
|
|
@@ -13772,8 +13811,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
13772
13811
|
}, {
|
|
13773
13812
|
key: "nor",
|
|
13774
13813
|
value: function () /*: ParseQuery*/{
|
|
13775
|
-
for (var
|
|
13776
|
-
queries[
|
|
13814
|
+
for (var _len11 = arguments.length, queries = new Array(_len11), _key15 = 0; _key15 < _len11; _key15++) {
|
|
13815
|
+
queries[_key15] = arguments[_key15];
|
|
13777
13816
|
}
|
|
13778
13817
|
var className = _getClassNameFromQueries(queries);
|
|
13779
13818
|
var query = new ParseQuery(className);
|