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.
@@ -226,6 +226,7 @@ var ParseQuery = /*#__PURE__*/function () {
226
226
  (0, _classCallCheck2.default)(this, ParseQuery);
227
227
  (0, _defineProperty2.default)(this, "className", void 0);
228
228
  (0, _defineProperty2.default)(this, "_where", void 0);
229
+ (0, _defineProperty2.default)(this, "_watch", void 0);
229
230
  (0, _defineProperty2.default)(this, "_include", void 0);
230
231
  (0, _defineProperty2.default)(this, "_exclude", void 0);
231
232
  (0, _defineProperty2.default)(this, "_select", void 0);
@@ -261,6 +262,7 @@ var ParseQuery = /*#__PURE__*/function () {
261
262
  throw new TypeError('A ParseQuery must be constructed with a ParseObject or class name.');
262
263
  }
263
264
  this._where = {};
265
+ this._watch = [];
264
266
  this._include = [];
265
267
  this._exclude = [];
266
268
  this._count = false;
@@ -453,6 +455,9 @@ var ParseQuery = /*#__PURE__*/function () {
453
455
  var params /*: QueryJSON*/ = {
454
456
  where: this._where
455
457
  };
458
+ if (this._watch.length) {
459
+ params.watch = this._watch.join(',');
460
+ }
456
461
  if (this._include.length) {
457
462
  params.include = this._include.join(',');
458
463
  }
@@ -522,6 +527,9 @@ var ParseQuery = /*#__PURE__*/function () {
522
527
  if (json.where) {
523
528
  this._where = json.where;
524
529
  }
530
+ if (json.watch) {
531
+ this._watch = json.watch.split(',');
532
+ }
525
533
  if (json.include) {
526
534
  this._include = json.include.split(',');
527
535
  }
@@ -2111,6 +2119,32 @@ var ParseQuery = /*#__PURE__*/function () {
2111
2119
  return this;
2112
2120
  }
2113
2121
 
2122
+ /**
2123
+ * Restricts live query to trigger only for watched fields.
2124
+ *
2125
+ * Requires Parse Server 6.0.0+
2126
+ *
2127
+ * @param {...string|Array<string>} keys The name(s) of the key(s) to watch.
2128
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
2129
+ */
2130
+ }, {
2131
+ key: "watch",
2132
+ value: function () /*: ParseQuery*/{
2133
+ var _this14 = this;
2134
+ for (var _len8 = arguments.length, keys = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
2135
+ keys[_key12] = arguments[_key12];
2136
+ }
2137
+ (0, _forEach.default)(keys).call(keys, function (key) {
2138
+ if ((0, _isArray.default)(key)) {
2139
+ var _context22;
2140
+ _this14._watch = (0, _concat.default)(_context22 = _this14._watch).call(_context22, key);
2141
+ } else {
2142
+ _this14._watch.push(key);
2143
+ }
2144
+ });
2145
+ return this;
2146
+ }
2147
+
2114
2148
  /**
2115
2149
  * Changes the read preference that the backend will use when performing the query to the database.
2116
2150
  *
@@ -2140,30 +2174,30 @@ var ParseQuery = /*#__PURE__*/function () {
2140
2174
  value: function () {
2141
2175
  var _subscribe = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(sessionToken /*:: ?: string*/) {
2142
2176
  var currentUser, liveQueryClient, subscription;
2143
- return _regenerator.default.wrap(function (_context22) {
2144
- while (1) switch (_context22.prev = _context22.next) {
2177
+ return _regenerator.default.wrap(function (_context23) {
2178
+ while (1) switch (_context23.prev = _context23.next) {
2145
2179
  case 0:
2146
- _context22.next = 2;
2180
+ _context23.next = 2;
2147
2181
  return _CoreManager.default.getUserController().currentUserAsync();
2148
2182
  case 2:
2149
- currentUser = _context22.sent;
2183
+ currentUser = _context23.sent;
2150
2184
  if (!sessionToken) {
2151
2185
  sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
2152
2186
  }
2153
- _context22.next = 6;
2187
+ _context23.next = 6;
2154
2188
  return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
2155
2189
  case 6:
2156
- liveQueryClient = _context22.sent;
2190
+ liveQueryClient = _context23.sent;
2157
2191
  if (liveQueryClient.shouldOpen()) {
2158
2192
  liveQueryClient.open();
2159
2193
  }
2160
2194
  subscription = liveQueryClient.subscribe(this, sessionToken);
2161
- return _context22.abrupt("return", subscription.subscribePromise.then(function () {
2195
+ return _context23.abrupt("return", subscription.subscribePromise.then(function () {
2162
2196
  return subscription;
2163
2197
  }));
2164
2198
  case 10:
2165
2199
  case "end":
2166
- return _context22.stop();
2200
+ return _context23.stop();
2167
2201
  }
2168
2202
  }, _callee7, this);
2169
2203
  }));
@@ -2245,7 +2279,7 @@ var ParseQuery = /*#__PURE__*/function () {
2245
2279
  }, {
2246
2280
  key: "cancel",
2247
2281
  value: function () /*: ParseQuery*/{
2248
- var _this14 = this;
2282
+ var _this15 = this;
2249
2283
  if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {
2250
2284
  this._xhrRequest.task._aborted = true;
2251
2285
  this._xhrRequest.task.abort();
@@ -2254,16 +2288,16 @@ var ParseQuery = /*#__PURE__*/function () {
2254
2288
  return this;
2255
2289
  }
2256
2290
  return this._xhrRequest.onchange = function () {
2257
- return _this14.cancel();
2291
+ return _this15.cancel();
2258
2292
  };
2259
2293
  }
2260
2294
  }, {
2261
2295
  key: "_setRequestTask",
2262
2296
  value: function (options) {
2263
- var _this15 = this;
2297
+ var _this16 = this;
2264
2298
  options.requestTask = function (task) {
2265
- _this15._xhrRequest.task = task;
2266
- _this15._xhrRequest.onchange();
2299
+ _this16._xhrRequest.task = task;
2300
+ _this16._xhrRequest.onchange();
2267
2301
  };
2268
2302
  }
2269
2303
  }], [{
@@ -2275,8 +2309,8 @@ var ParseQuery = /*#__PURE__*/function () {
2275
2309
  }, {
2276
2310
  key: "or",
2277
2311
  value: function () /*: ParseQuery*/{
2278
- for (var _len8 = arguments.length, queries = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
2279
- queries[_key12] = arguments[_key12];
2312
+ for (var _len9 = arguments.length, queries = new Array(_len9), _key13 = 0; _key13 < _len9; _key13++) {
2313
+ queries[_key13] = arguments[_key13];
2280
2314
  }
2281
2315
  var className = _getClassNameFromQueries(queries);
2282
2316
  var query = new ParseQuery(className);
@@ -2299,8 +2333,8 @@ var ParseQuery = /*#__PURE__*/function () {
2299
2333
  }, {
2300
2334
  key: "and",
2301
2335
  value: function () /*: ParseQuery*/{
2302
- for (var _len9 = arguments.length, queries = new Array(_len9), _key13 = 0; _key13 < _len9; _key13++) {
2303
- queries[_key13] = arguments[_key13];
2336
+ for (var _len10 = arguments.length, queries = new Array(_len10), _key14 = 0; _key14 < _len10; _key14++) {
2337
+ queries[_key14] = arguments[_key14];
2304
2338
  }
2305
2339
  var className = _getClassNameFromQueries(queries);
2306
2340
  var query = new ParseQuery(className);
@@ -2323,8 +2357,8 @@ var ParseQuery = /*#__PURE__*/function () {
2323
2357
  }, {
2324
2358
  key: "nor",
2325
2359
  value: function () /*: ParseQuery*/{
2326
- for (var _len10 = arguments.length, queries = new Array(_len10), _key14 = 0; _key14 < _len10; _key14++) {
2327
- queries[_key14] = arguments[_key14];
2360
+ for (var _len11 = arguments.length, queries = new Array(_len11), _key15 = 0; _key15 < _len11; _key15++) {
2361
+ queries[_key15] = arguments[_key15];
2328
2362
  }
2329
2363
  var className = _getClassNameFromQueries(queries);
2330
2364
  var query = new ParseQuery(className);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parse",
3
- "version": "4.1.0-alpha.1",
3
+ "version": "4.1.0-alpha.3",
4
4
  "description": "Parse JavaScript SDK",
5
5
  "homepage": "https://parseplatform.org",
6
6
  "keywords": [
@@ -37,8 +37,8 @@
37
37
  "xmlhttprequest": "1.8.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@babel/core": "7.21.0",
41
- "@babel/eslint-parser": "7.19.1",
40
+ "@babel/core": "7.21.3",
41
+ "@babel/eslint-parser": "7.21.3",
42
42
  "@babel/plugin-proposal-class-properties": "7.18.6",
43
43
  "@babel/plugin-transform-flow-comments": "7.21.0",
44
44
  "@babel/plugin-transform-flow-strip-types": "7.21.0",
@@ -47,23 +47,23 @@
47
47
  "@babel/preset-react": "7.18.6",
48
48
  "@parse/minami": "1.0.0",
49
49
  "@saithodev/semantic-release-backmerge": "2.1.3",
50
- "@semantic-release/changelog": "6.0.2",
50
+ "@semantic-release/changelog": "6.0.3",
51
51
  "@semantic-release/commit-analyzer": "9.0.2",
52
52
  "@semantic-release/git": "10.0.1",
53
53
  "@semantic-release/github": "8.0.7",
54
54
  "@semantic-release/npm": "9.0.2",
55
55
  "@semantic-release/release-notes-generator": "10.0.3",
56
- "babel-jest": "29.4.3",
56
+ "babel-jest": "29.5.0",
57
57
  "babel-plugin-inline-package-json": "2.0.0",
58
58
  "babel-plugin-minify-dead-code-elimination": "0.5.2",
59
59
  "babel-plugin-transform-inline-environment-variables": "0.4.4",
60
60
  "browserify": "17.0.0",
61
61
  "codecov": "3.8.3",
62
- "core-js": "3.29.0",
62
+ "core-js": "3.29.1",
63
63
  "cross-env": "7.0.2",
64
- "eslint": "8.35.0",
64
+ "eslint": "8.36.0",
65
65
  "eslint-plugin-flowtype": "8.0.3",
66
- "eslint-plugin-jsdoc": "40.0.0",
66
+ "eslint-plugin-jsdoc": "40.1.0",
67
67
  "express": "4.18.2",
68
68
  "gulp": "4.0.2",
69
69
  "gulp-babel": "8.0.0",
@@ -73,19 +73,19 @@
73
73
  "gulp-uglify": "3.0.2",
74
74
  "gulp-watch": "5.0.1",
75
75
  "husky": "8.0.3",
76
- "jasmine": "4.5.0",
76
+ "jasmine": "4.6.0",
77
77
  "jasmine-reporters": "2.5.2",
78
78
  "jasmine-spec-reporter": "7.0.0",
79
- "jest": "29.4.3",
80
- "jest-environment-jsdom": "29.4.3",
79
+ "jest": "29.5.0",
80
+ "jest-environment-jsdom": "29.5.0",
81
81
  "jsdoc": "4.0.2",
82
82
  "jsdoc-babel": "0.5.0",
83
- "lint-staged": "13.1.2",
84
- "metro-react-native-babel-preset": "0.75.1",
83
+ "lint-staged": "13.2.0",
84
+ "metro-react-native-babel-preset": "0.76.0",
85
85
  "mongodb-runner": "4.10.0",
86
86
  "parse-server": "git+https://github.com/parse-community/parse-server#alpha",
87
- "prettier": "2.8.4",
88
- "puppeteer": "19.7.2",
87
+ "prettier": "2.8.7",
88
+ "puppeteer": "19.8.0",
89
89
  "regenerator-runtime": "0.13.11",
90
90
  "semantic-release": "19.0.5",
91
91
  "vinyl-source-stream": "2.0.0"