parse 4.1.0 → 4.2.0-alpha.10

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.
Files changed (120) hide show
  1. package/dist/parse.js +2123 -1542
  2. package/dist/parse.min.js +2 -2
  3. package/dist/parse.weapp.js +2105 -1524
  4. package/dist/parse.weapp.min.js +2 -2
  5. package/lib/browser/AnonymousUtils.js +1 -1
  6. package/lib/browser/Cloud.js +4 -2
  7. package/lib/browser/CoreManager.js +31 -4
  8. package/lib/browser/EventEmitter.js +7 -2
  9. package/lib/browser/EventuallyQueue.js +24 -4
  10. package/lib/browser/LiveQueryClient.js +59 -89
  11. package/lib/browser/LiveQuerySubscription.js +16 -51
  12. package/lib/browser/LocalDatastore.js +10 -1
  13. package/lib/browser/LocalDatastoreController.js +3 -1
  14. package/lib/browser/ObjectStateMutations.js +17 -2
  15. package/lib/browser/OfflineQuery.js +1 -1
  16. package/lib/browser/Parse.js +171 -135
  17. package/lib/browser/ParseACL.js +2 -1
  18. package/lib/browser/ParseCLP.js +6 -1
  19. package/lib/browser/ParseConfig.js +1 -0
  20. package/lib/browser/ParseError.js +12 -1
  21. package/lib/browser/ParseFile.js +5 -1
  22. package/lib/browser/ParseInstallation.js +4 -1
  23. package/lib/browser/ParseLiveQuery.js +79 -51
  24. package/lib/browser/ParseObject.js +11 -8
  25. package/lib/browser/ParseOp.js +3 -1
  26. package/lib/browser/ParseQuery.js +122 -72
  27. package/lib/browser/ParseRole.js +5 -1
  28. package/lib/browser/ParseSchema.js +23 -2
  29. package/lib/browser/ParseSession.js +1 -1
  30. package/lib/browser/ParseUser.js +107 -9
  31. package/lib/browser/Push.js +8 -2
  32. package/lib/browser/RESTController.js +20 -0
  33. package/lib/browser/SingleInstanceStateController.js +6 -1
  34. package/lib/browser/Storage.js +7 -0
  35. package/lib/browser/TaskQueue.js +4 -0
  36. package/lib/browser/UniqueInstanceStateController.js +3 -1
  37. package/lib/browser/unsavedChildren.js +4 -1
  38. package/lib/node/AnonymousUtils.js +1 -1
  39. package/lib/node/Cloud.js +4 -2
  40. package/lib/node/CoreManager.js +30 -4
  41. package/lib/node/EventEmitter.js +7 -1
  42. package/lib/node/EventuallyQueue.js +23 -4
  43. package/lib/node/LiveQueryClient.js +10 -7
  44. package/lib/node/LiveQuerySubscription.js +5 -7
  45. package/lib/node/LocalDatastore.js +7 -1
  46. package/lib/node/ObjectStateMutations.js +14 -2
  47. package/lib/node/OfflineQuery.js +1 -1
  48. package/lib/node/Parse.js +162 -126
  49. package/lib/node/ParseACL.js +2 -1
  50. package/lib/node/ParseCLP.js +3 -1
  51. package/lib/node/ParseConfig.js +1 -2
  52. package/lib/node/ParseError.js +15 -1
  53. package/lib/node/ParseFile.js +2 -1
  54. package/lib/node/ParseInstallation.js +1 -1
  55. package/lib/node/ParseLiveQuery.js +32 -24
  56. package/lib/node/ParseObject.js +3 -2
  57. package/lib/node/ParseQuery.js +53 -7
  58. package/lib/node/ParseRole.js +2 -1
  59. package/lib/node/ParseSchema.js +21 -2
  60. package/lib/node/ParseSession.js +1 -5
  61. package/lib/node/ParseUser.js +95 -9
  62. package/lib/node/Push.js +8 -2
  63. package/lib/node/RESTController.js +20 -0
  64. package/lib/node/SingleInstanceStateController.js +6 -1
  65. package/lib/node/Storage.js +6 -0
  66. package/lib/node/TaskQueue.js +4 -1
  67. package/lib/node/UniqueInstanceStateController.js +3 -1
  68. package/lib/node/unsavedChildren.js +4 -1
  69. package/lib/react-native/Cloud.js +3 -0
  70. package/lib/react-native/CoreManager.js +30 -4
  71. package/lib/react-native/EventEmitter.js +8 -5
  72. package/lib/react-native/EventuallyQueue.js +10 -3
  73. package/lib/react-native/LiveQueryClient.js +44 -70
  74. package/lib/react-native/LiveQuerySubscription.js +16 -46
  75. package/lib/react-native/LocalDatastore.js +6 -0
  76. package/lib/react-native/ObjectStateMutations.js +3 -1
  77. package/lib/react-native/OfflineQuery.js +1 -1
  78. package/lib/react-native/Parse.js +127 -90
  79. package/lib/react-native/ParseCLP.js +2 -2
  80. package/lib/react-native/ParseError.js +8 -1
  81. package/lib/react-native/ParseFile.js +1 -0
  82. package/lib/react-native/ParseLiveQuery.js +39 -11
  83. package/lib/react-native/ParseQuery.js +37 -17
  84. package/lib/react-native/ParseSchema.js +14 -1
  85. package/lib/react-native/ParseUser.js +74 -6
  86. package/lib/react-native/Storage.js +6 -0
  87. package/lib/weapp/AnonymousUtils.js +1 -1
  88. package/lib/weapp/Cloud.js +4 -2
  89. package/lib/weapp/CoreManager.js +31 -4
  90. package/lib/weapp/EventEmitter.js +7 -2
  91. package/lib/weapp/EventuallyQueue.js +24 -4
  92. package/lib/weapp/LiveQueryClient.js +59 -89
  93. package/lib/weapp/LiveQuerySubscription.js +16 -51
  94. package/lib/weapp/LocalDatastore.js +10 -1
  95. package/lib/weapp/LocalDatastoreController.js +3 -1
  96. package/lib/weapp/ObjectStateMutations.js +17 -2
  97. package/lib/weapp/OfflineQuery.js +1 -1
  98. package/lib/weapp/Parse.js +170 -134
  99. package/lib/weapp/ParseACL.js +2 -1
  100. package/lib/weapp/ParseCLP.js +6 -1
  101. package/lib/weapp/ParseConfig.js +1 -0
  102. package/lib/weapp/ParseError.js +12 -1
  103. package/lib/weapp/ParseFile.js +5 -1
  104. package/lib/weapp/ParseInstallation.js +4 -1
  105. package/lib/weapp/ParseLiveQuery.js +79 -51
  106. package/lib/weapp/ParseObject.js +11 -8
  107. package/lib/weapp/ParseOp.js +3 -1
  108. package/lib/weapp/ParseQuery.js +122 -72
  109. package/lib/weapp/ParseRole.js +5 -1
  110. package/lib/weapp/ParseSchema.js +23 -2
  111. package/lib/weapp/ParseSession.js +1 -1
  112. package/lib/weapp/ParseUser.js +107 -9
  113. package/lib/weapp/Push.js +8 -2
  114. package/lib/weapp/RESTController.js +20 -0
  115. package/lib/weapp/SingleInstanceStateController.js +6 -1
  116. package/lib/weapp/Storage.js +7 -0
  117. package/lib/weapp/TaskQueue.js +4 -0
  118. package/lib/weapp/UniqueInstanceStateController.js +3 -1
  119. package/lib/weapp/unsavedChildren.js +4 -1
  120. package/package.json +29 -25
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
4
3
  var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
5
4
  var _Array$from = require("@babel/runtime-corejs3/core-js-stable/array/from");
6
5
  var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
@@ -23,13 +22,8 @@ var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stabl
23
22
  var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
24
23
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
25
24
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
26
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
27
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
28
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
29
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
30
25
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
31
26
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
32
- var _EventEmitter2 = _interopRequireDefault(require("./EventEmitter"));
33
27
  var _ParseObject = _interopRequireDefault(require("./ParseObject"));
34
28
  var _LiveQuerySubscription = _interopRequireDefault(require("./LiveQuerySubscription"));
35
29
  var _promiseUtils = require("./promiseUtils");
@@ -98,32 +92,7 @@ function _arrayLikeToArray(arr, len) {
98
92
  if (len == null || len > arr.length) len = arr.length;
99
93
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
100
94
  return arr2;
101
- }
102
- function _createSuper(Derived) {
103
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
104
- return function () {
105
- var Super = (0, _getPrototypeOf2.default)(Derived),
106
- result;
107
- if (hasNativeReflectConstruct) {
108
- var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
109
- result = _Reflect$construct(Super, arguments, NewTarget);
110
- } else {
111
- result = Super.apply(this, arguments);
112
- }
113
- return (0, _possibleConstructorReturn2.default)(this, result);
114
- };
115
- }
116
- function _isNativeReflectConstruct() {
117
- if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
118
- if (_Reflect$construct.sham) return false;
119
- if (typeof Proxy === "function") return true;
120
- try {
121
- Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
122
- return true;
123
- } catch (e) {
124
- return false;
125
- }
126
- }
95
+ } /* global WebSocket */
127
96
  // The LiveQuery client inner state
128
97
  var CLIENT_STATE = {
129
98
  INITIALIZED: 'initialized',
@@ -179,7 +148,6 @@ var generateInterval = function (k) {
179
148
 
180
149
  /**
181
150
  * Creates a new LiveQueryClient.
182
- * Extends events.EventEmitter
183
151
  * <a href="https://nodejs.org/api/events.html#events_class_eventemitter">cloud functions</a>.
184
152
  *
185
153
  * A wrapper of a standard WebSocket client. We add several useful methods to
@@ -221,9 +189,7 @@ var generateInterval = function (k) {
221
189
  *
222
190
  * @alias Parse.LiveQueryClient
223
191
  */
224
- var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
225
- (0, _inherits2.default)(LiveQueryClient, _EventEmitter);
226
- var _super = _createSuper(LiveQueryClient);
192
+ var LiveQueryClient = /*#__PURE__*/function () {
227
193
  /**
228
194
  * @param {object} options
229
195
  * @param {string} options.applicationId - applicationId of your Parse app
@@ -234,7 +200,6 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
234
200
  * @param {string} options.installationId (optional)
235
201
  */
236
202
  function LiveQueryClient(_ref) {
237
- var _this;
238
203
  var applicationId = _ref.applicationId,
239
204
  serverURL = _ref.serverURL,
240
205
  javascriptKey = _ref.javascriptKey,
@@ -242,43 +207,44 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
242
207
  sessionToken = _ref.sessionToken,
243
208
  installationId = _ref.installationId;
244
209
  (0, _classCallCheck2.default)(this, LiveQueryClient);
245
- _this = _super.call(this);
246
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "attempts", void 0);
247
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "id", void 0);
248
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "requestId", void 0);
249
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "applicationId", void 0);
250
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "serverURL", void 0);
251
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "javascriptKey", void 0);
252
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "masterKey", void 0);
253
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sessionToken", void 0);
254
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "installationId", void 0);
255
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "additionalProperties", void 0);
256
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "connectPromise", void 0);
257
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "subscriptions", void 0);
258
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "socket", void 0);
259
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", void 0);
210
+ (0, _defineProperty2.default)(this, "attempts", void 0);
211
+ (0, _defineProperty2.default)(this, "id", void 0);
212
+ (0, _defineProperty2.default)(this, "requestId", void 0);
213
+ (0, _defineProperty2.default)(this, "applicationId", void 0);
214
+ (0, _defineProperty2.default)(this, "serverURL", void 0);
215
+ (0, _defineProperty2.default)(this, "javascriptKey", void 0);
216
+ (0, _defineProperty2.default)(this, "masterKey", void 0);
217
+ (0, _defineProperty2.default)(this, "sessionToken", void 0);
218
+ (0, _defineProperty2.default)(this, "installationId", void 0);
219
+ (0, _defineProperty2.default)(this, "additionalProperties", void 0);
220
+ (0, _defineProperty2.default)(this, "connectPromise", void 0);
221
+ (0, _defineProperty2.default)(this, "subscriptions", void 0);
222
+ (0, _defineProperty2.default)(this, "socket", void 0);
223
+ (0, _defineProperty2.default)(this, "state", void 0);
260
224
  if (!serverURL || (0, _indexOf.default)(serverURL).call(serverURL, 'ws') !== 0) {
261
225
  throw new Error('You need to set a proper Parse LiveQuery server url before using LiveQueryClient');
262
226
  }
263
- _this.reconnectHandle = null;
264
- _this.attempts = 1;
265
- _this.id = 0;
266
- _this.requestId = 1;
267
- _this.serverURL = serverURL;
268
- _this.applicationId = applicationId;
269
- _this.javascriptKey = javascriptKey || undefined;
270
- _this.masterKey = masterKey || undefined;
271
- _this.sessionToken = sessionToken || undefined;
272
- _this.installationId = installationId || undefined;
273
- _this.additionalProperties = true;
274
- _this.connectPromise = (0, _promiseUtils.resolvingPromise)();
275
- _this.subscriptions = new _map.default();
276
- _this.state = CLIENT_STATE.INITIALIZED;
277
-
227
+ this.reconnectHandle = null;
228
+ this.attempts = 1;
229
+ this.id = 0;
230
+ this.requestId = 1;
231
+ this.serverURL = serverURL;
232
+ this.applicationId = applicationId;
233
+ this.javascriptKey = javascriptKey || undefined;
234
+ this.masterKey = masterKey || undefined;
235
+ this.sessionToken = sessionToken || undefined;
236
+ this.installationId = installationId || undefined;
237
+ this.additionalProperties = true;
238
+ this.connectPromise = (0, _promiseUtils.resolvingPromise)();
239
+ this.subscriptions = new _map.default();
240
+ this.state = CLIENT_STATE.INITIALIZED;
241
+ var EventEmitter = _CoreManager.default.getEventEmitter();
242
+ this.emitter = new EventEmitter();
243
+ this.on = this.emitter.on;
244
+ this.emit = this.emitter.emit;
278
245
  // adding listener so process does not crash
279
246
  // best practice is for developer to register their own listener
280
- _this.on('error', function () {});
281
- return _this;
247
+ this.on('error', function () {});
282
248
  }
283
249
  (0, _createClass2.default)(LiveQueryClient, [{
284
250
  key: "shouldOpen",
@@ -303,21 +269,25 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
303
269
  }, {
304
270
  key: "subscribe",
305
271
  value: function (query /*: Object*/, sessionToken /*: ?string*/) /*: LiveQuerySubscription*/{
306
- var _this2 = this;
272
+ var _queryJSON$keys,
273
+ _queryJSON$watch,
274
+ _this = this;
307
275
  if (!query) {
308
276
  return;
309
277
  }
310
278
  var className = query.className;
311
279
  var queryJSON = query.toJSON();
312
280
  var where = queryJSON.where;
313
- var fields = (0, _keys.default)(queryJSON) ? (0, _keys.default)(queryJSON).split(',') : undefined;
281
+ var fields = (_queryJSON$keys = (0, _keys.default)(queryJSON)) === null || _queryJSON$keys === void 0 ? void 0 : _queryJSON$keys.split(',');
282
+ var watch = (_queryJSON$watch = queryJSON.watch) === null || _queryJSON$watch === void 0 ? void 0 : _queryJSON$watch.split(',');
314
283
  var subscribeRequest = {
315
284
  op: OP_TYPES.SUBSCRIBE,
316
285
  requestId: this.requestId,
317
286
  query: {
318
287
  className: className,
319
288
  where: where,
320
- fields: fields
289
+ fields: fields,
290
+ watch: watch
321
291
  }
322
292
  };
323
293
  if (sessionToken) {
@@ -327,7 +297,7 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
327
297
  this.subscriptions.set(this.requestId, subscription);
328
298
  this.requestId += 1;
329
299
  this.connectPromise.then(function () {
330
- _this2.socket.send((0, _stringify.default)(subscribeRequest));
300
+ _this.socket.send((0, _stringify.default)(subscribeRequest));
331
301
  }).catch(function (error) {
332
302
  subscription.subscribePromise.reject(error);
333
303
  });
@@ -343,7 +313,7 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
343
313
  }, {
344
314
  key: "unsubscribe",
345
315
  value: function (subscription /*: Object*/) /*: ?Promise*/{
346
- var _this3 = this;
316
+ var _this2 = this;
347
317
  if (!subscription) {
348
318
  return;
349
319
  }
@@ -352,7 +322,7 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
352
322
  requestId: subscription.id
353
323
  };
354
324
  return this.connectPromise.then(function () {
355
- return _this3.socket.send((0, _stringify.default)(unsubscribeRequest));
325
+ return _this2.socket.send((0, _stringify.default)(unsubscribeRequest));
356
326
  }).then(function () {
357
327
  return subscription.unsubscribePromise;
358
328
  });
@@ -366,7 +336,7 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
366
336
  }, {
367
337
  key: "open",
368
338
  value: function () {
369
- var _this4 = this;
339
+ var _this3 = this;
370
340
  var WebSocketImplementation = _CoreManager.default.getWebSocketController();
371
341
  if (!WebSocketImplementation) {
372
342
  this.emit(CLIENT_EMMITER_TYPES.ERROR, 'Can not find WebSocket implementation');
@@ -380,24 +350,24 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
380
350
 
381
351
  // Bind WebSocket callbacks
382
352
  this.socket.onopen = function () {
383
- _this4._handleWebSocketOpen();
353
+ _this3._handleWebSocketOpen();
384
354
  };
385
355
  this.socket.onmessage = function (event) {
386
- _this4._handleWebSocketMessage(event);
356
+ _this3._handleWebSocketMessage(event);
387
357
  };
388
358
  this.socket.onclose = function (event) {
389
- _this4.socket.closingPromise.resolve(event);
390
- _this4._handleWebSocketClose();
359
+ _this3.socket.closingPromise.resolve(event);
360
+ _this3._handleWebSocketClose();
391
361
  };
392
362
  this.socket.onerror = function (error) {
393
- _this4._handleWebSocketError(error);
363
+ _this3._handleWebSocketError(error);
394
364
  };
395
365
  }
396
366
  }, {
397
367
  key: "resubscribe",
398
368
  value: function () {
399
369
  var _context,
400
- _this5 = this;
370
+ _this4 = this;
401
371
  (0, _forEach.default)(_context = this.subscriptions).call(_context, function (subscription, requestId) {
402
372
  var query = subscription.query;
403
373
  var queryJSON = query.toJSON();
@@ -417,8 +387,8 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
417
387
  if (sessionToken) {
418
388
  subscribeRequest.sessionToken = sessionToken;
419
389
  }
420
- _this5.connectPromise.then(function () {
421
- _this5.socket.send((0, _stringify.default)(subscribeRequest));
390
+ _this4.connectPromise.then(function () {
391
+ _this4.socket.send((0, _stringify.default)(subscribeRequest));
422
392
  });
423
393
  });
424
394
  }
@@ -630,7 +600,7 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
630
600
  key: "_handleReconnect",
631
601
  value: function () {
632
602
  var _context5,
633
- _this6 = this;
603
+ _this5 = this;
634
604
  // if closed or currently reconnecting we stop attempting to reconnect
635
605
  if (this.state === CLIENT_STATE.DISCONNECTED) {
636
606
  return;
@@ -647,14 +617,14 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
647
617
  clearTimeout(this.reconnectHandle);
648
618
  }
649
619
  this.reconnectHandle = (0, _setTimeout2.default)((0, _bind.default)(_context5 = function () {
650
- _this6.attempts++;
651
- _this6.connectPromise = (0, _promiseUtils.resolvingPromise)();
652
- _this6.open();
620
+ _this5.attempts++;
621
+ _this5.connectPromise = (0, _promiseUtils.resolvingPromise)();
622
+ _this5.open();
653
623
  }).call(_context5, this), time);
654
624
  }
655
625
  }]);
656
626
  return LiveQueryClient;
657
- }(_EventEmitter2.default);
627
+ }();
658
628
  _CoreManager.default.setWebSocketController(require('./Socket.weapp'));
659
629
  var _default = LiveQueryClient;
660
630
  exports.default = _default;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
4
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
5
  _Object$defineProperty(exports, "__esModule", {
@@ -9,40 +8,10 @@ _Object$defineProperty(exports, "__esModule", {
9
8
  exports.default = void 0;
10
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
11
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
12
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
13
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
14
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
15
- var _EventEmitter2 = _interopRequireDefault(require("./EventEmitter"));
16
11
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
17
12
  var _promiseUtils = require("./promiseUtils");
18
- function _createSuper(Derived) {
19
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
20
- return function () {
21
- var Super = (0, _getPrototypeOf2.default)(Derived),
22
- result;
23
- if (hasNativeReflectConstruct) {
24
- var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
25
- result = _Reflect$construct(Super, arguments, NewTarget);
26
- } else {
27
- result = Super.apply(this, arguments);
28
- }
29
- return (0, _possibleConstructorReturn2.default)(this, result);
30
- };
31
- }
32
- function _isNativeReflectConstruct() {
33
- if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
34
- if (_Reflect$construct.sham) return false;
35
- if (typeof Proxy === "function") return true;
36
- try {
37
- Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
38
- return true;
39
- } catch (e) {
40
- return false;
41
- }
42
- }
43
13
  /**
44
14
  * Creates a new LiveQuery Subscription.
45
- * Extends events.EventEmitter
46
15
  * <a href="https://nodejs.org/api/events.html#events_class_eventemitter">cloud functions</a>.
47
16
  *
48
17
  * <p>Response Object - Contains data from the client that made the request
@@ -122,32 +91,28 @@ function _isNativeReflectConstruct() {
122
91
  * subscription.on('close', () => {
123
92
  *
124
93
  * });</pre></p>
125
- *
126
- * @alias Parse.LiveQuerySubscription
127
94
  */
128
- var Subscription = /*#__PURE__*/function (_EventEmitter) {
129
- (0, _inherits2.default)(Subscription, _EventEmitter);
130
- var _super = _createSuper(Subscription);
95
+ var Subscription = /*#__PURE__*/function () {
131
96
  /*
132
97
  * @param {string} id - subscription id
133
98
  * @param {string} query - query to subscribe to
134
99
  * @param {string} sessionToken - optional session token
135
100
  */
136
101
  function Subscription(id, query, sessionToken) {
137
- var _this;
138
102
  (0, _classCallCheck2.default)(this, Subscription);
139
- _this = _super.call(this);
140
- _this.id = id;
141
- _this.query = query;
142
- _this.sessionToken = sessionToken;
143
- _this.subscribePromise = (0, _promiseUtils.resolvingPromise)();
144
- _this.unsubscribePromise = (0, _promiseUtils.resolvingPromise)();
145
- _this.subscribed = false;
146
-
103
+ this.id = id;
104
+ this.query = query;
105
+ this.sessionToken = sessionToken;
106
+ this.subscribePromise = (0, _promiseUtils.resolvingPromise)();
107
+ this.unsubscribePromise = (0, _promiseUtils.resolvingPromise)();
108
+ this.subscribed = false;
109
+ var EventEmitter = _CoreManager.default.getEventEmitter();
110
+ this.emitter = new EventEmitter();
111
+ this.on = this.emitter.on;
112
+ this.emit = this.emitter.emit;
147
113
  // adding listener so process does not crash
148
114
  // best practice is for developer to register their own listener
149
- _this.on('error', function () {});
150
- return _this;
115
+ this.on('error', function () {});
151
116
  }
152
117
 
153
118
  /**
@@ -158,14 +123,14 @@ var Subscription = /*#__PURE__*/function (_EventEmitter) {
158
123
  (0, _createClass2.default)(Subscription, [{
159
124
  key: "unsubscribe",
160
125
  value: function () /*: Promise*/{
161
- var _this2 = this;
126
+ var _this = this;
162
127
  return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient().then(function (liveQueryClient) {
163
- _this2.emit('close');
164
- return liveQueryClient.unsubscribe(_this2);
128
+ _this.emit('close');
129
+ return liveQueryClient.unsubscribe(_this);
165
130
  });
166
131
  }
167
132
  }]);
168
133
  return Subscription;
169
- }(_EventEmitter2.default);
134
+ }();
170
135
  var _default = Subscription;
171
136
  exports.default = _default;
@@ -5,7 +5,12 @@ var _Array$from2 = require("@babel/runtime-corejs3/core-js-stable/array/from");
5
5
  var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
6
6
  var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
7
7
  var _Array$isArray2 = require("@babel/runtime-corejs3/core-js-stable/array/is-array");
8
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
8
9
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
10
+ _Object$defineProperty(exports, "__esModule", {
11
+ value: true
12
+ });
13
+ exports.default = void 0;
9
14
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
10
15
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
11
16
  var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
@@ -89,7 +94,9 @@ function _arrayLikeToArray(arr, len) {
89
94
  if (len == null || len > arr.length) len = arr.length;
90
95
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
91
96
  return arr2;
92
- }
97
+ } /**
98
+ * @flow
99
+ */ /*:: import type ParseObject from './ParseObject';*/
93
100
  /**
94
101
  * Provides a local datastore which can be used to store and retrieve <code>Parse.Object</code>. <br />
95
102
  * To enable this functionality, call <code>Parse.enableLocalDatastore()</code>.
@@ -697,5 +704,7 @@ var LocalDatastore = {
697
704
  }
698
705
  };
699
706
  module.exports = LocalDatastore;
707
+ var _default = LocalDatastore;
708
+ exports.default = _default;
700
709
  _CoreManager.default.setLocalDatastoreController(require('./LocalDatastoreController'));
701
710
  _CoreManager.default.setLocalDatastore(LocalDatastore);
@@ -78,7 +78,9 @@ function _arrayLikeToArray(arr, len) {
78
78
  if (len == null || len > arr.length) len = arr.length;
79
79
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
80
80
  return arr2;
81
- }
81
+ } /**
82
+ * @flow
83
+ */
82
84
  var LocalDatastoreController = {
83
85
  fromPinWithName: function (name /*: string*/) /*: Array<Object>*/{
84
86
  return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
@@ -52,7 +52,20 @@ function _objectSpread(target) {
52
52
  });
53
53
  }
54
54
  return target;
55
- }
55
+ } /**
56
+ * @flow
57
+ */
58
+ /*:: import type { Op } from './ParseOp';*/
59
+ /*:: export type AttributeMap = { [attr: string]: any };*/
60
+ /*:: export type OpsMap = { [attr: string]: Op };*/
61
+ /*:: export type ObjectCache = { [attr: string]: string };*/
62
+ /*:: export type State = {
63
+ serverData: AttributeMap,
64
+ pendingOps: Array<OpsMap>,
65
+ objectCache: ObjectCache,
66
+ tasks: TaskQueue,
67
+ existed: boolean,
68
+ };*/
56
69
  function defaultState() /*: State*/{
57
70
  return {
58
71
  serverData: {},
@@ -162,7 +175,9 @@ function estimateAttributes(serverData /*: AttributeMap*/, pendingOps /*: Array<
162
175
  function nestedSet(obj, key, value) {
163
176
  var path = key.split('.');
164
177
  for (var i = 0; i < path.length - 1; i++) {
165
- if (!(path[i] in obj)) obj[path[i]] = {};
178
+ if (!(path[i] in obj)) {
179
+ obj[path[i]] = {};
180
+ }
166
181
  obj = obj[path[i]];
167
182
  }
168
183
  if (typeof value === 'undefined') {
@@ -607,7 +607,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
607
607
  var _distance = point.radiansTo(centerPoint);
608
608
  return _distance <= maxDistance;
609
609
  }
610
- break;
610
+ return false;
611
611
  }
612
612
  case '$geoIntersects':
613
613
  {