parse 5.1.0-alpha.1 → 5.1.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 (139) hide show
  1. package/README.md +13 -0
  2. package/dist/parse.js +1452 -1043
  3. package/dist/parse.min.js +2 -2
  4. package/dist/parse.weapp.js +2355 -1082
  5. package/dist/parse.weapp.min.js +2 -2
  6. package/lib/browser/CoreManager.js +48 -171
  7. package/lib/browser/InstallationController.js +134 -23
  8. package/lib/browser/LiveQueryClient.js +43 -35
  9. package/lib/browser/LiveQuerySubscription.js +15 -5
  10. package/lib/browser/LocalDatastoreController.default.js +248 -0
  11. package/lib/browser/LocalDatastoreController.js +1 -246
  12. package/lib/browser/ObjectStateMutations.js +6 -5
  13. package/lib/browser/OfflineQuery.js +3 -2
  14. package/lib/browser/Parse.js +31 -7
  15. package/lib/browser/ParseACL.js +21 -11
  16. package/lib/browser/ParseFile.js +4 -0
  17. package/lib/browser/ParseHooks.js +2 -0
  18. package/lib/browser/ParseInstallation.js +274 -13
  19. package/lib/browser/ParseLiveQuery.js +32 -23
  20. package/lib/browser/ParseObject.js +37 -40
  21. package/lib/browser/ParseOp.js +21 -7
  22. package/lib/browser/ParseQuery.js +1 -0
  23. package/lib/browser/ParseRelation.js +12 -7
  24. package/lib/browser/ParseRole.js +2 -0
  25. package/lib/browser/ParseSession.js +1 -1
  26. package/lib/browser/ParseUser.js +51 -15
  27. package/lib/browser/RESTController.js +6 -5
  28. package/lib/browser/SingleInstanceStateController.js +2 -4
  29. package/lib/browser/Storage.js +1 -2
  30. package/lib/browser/StorageController.js +3 -0
  31. package/lib/browser/WebSocketController.js +13 -0
  32. package/lib/browser/arrayContainsObject.js +4 -3
  33. package/lib/browser/canBeSerialized.js +6 -4
  34. package/lib/browser/decode.js +8 -5
  35. package/lib/browser/encode.js +6 -4
  36. package/lib/browser/equals.js +4 -3
  37. package/lib/browser/unique.js +3 -2
  38. package/lib/browser/unsavedChildren.js +4 -2
  39. package/lib/browser/uuid.js +11 -5
  40. package/lib/node/CoreManager.js +48 -171
  41. package/lib/node/InstallationController.js +65 -21
  42. package/lib/node/LiveQueryClient.js +2 -5
  43. package/lib/node/LiveQuerySubscription.js +2 -2
  44. package/lib/node/LocalDatastoreController.default.js +67 -0
  45. package/lib/node/LocalDatastoreController.js +1 -65
  46. package/lib/node/ObjectStateMutations.js +8 -9
  47. package/lib/node/OfflineQuery.js +3 -2
  48. package/lib/node/Parse.js +31 -7
  49. package/lib/node/ParseACL.js +21 -11
  50. package/lib/node/ParseFile.js +4 -0
  51. package/lib/node/ParseHooks.js +2 -0
  52. package/lib/node/ParseInstallation.js +207 -7
  53. package/lib/node/ParseLiveQuery.js +2 -3
  54. package/lib/node/ParseObject.js +9 -12
  55. package/lib/node/ParseOp.js +21 -7
  56. package/lib/node/ParseQuery.js +1 -0
  57. package/lib/node/ParseRelation.js +14 -8
  58. package/lib/node/ParseRole.js +2 -0
  59. package/lib/node/ParseSession.js +1 -1
  60. package/lib/node/ParseUser.js +20 -13
  61. package/lib/node/RESTController.js +5 -5
  62. package/lib/node/SingleInstanceStateController.js +2 -8
  63. package/lib/node/Storage.js +1 -2
  64. package/lib/node/StorageController.js +3 -0
  65. package/lib/node/WebSocketController.js +10 -0
  66. package/lib/node/arrayContainsObject.js +4 -3
  67. package/lib/node/canBeSerialized.js +6 -4
  68. package/lib/node/decode.js +9 -5
  69. package/lib/node/encode.js +7 -4
  70. package/lib/node/equals.js +4 -3
  71. package/lib/node/unique.js +3 -2
  72. package/lib/node/unsavedChildren.js +4 -2
  73. package/lib/node/uuid.js +10 -8
  74. package/lib/react-native/CoreManager.js +39 -2
  75. package/lib/react-native/InstallationController.js +77 -9
  76. package/lib/react-native/LiveQueryClient.js +28 -20
  77. package/lib/react-native/LiveQuerySubscription.js +14 -5
  78. package/lib/react-native/LocalDatastoreController.default.js +91 -0
  79. package/lib/react-native/LocalDatastoreController.js +1 -91
  80. package/lib/react-native/ObjectStateMutations.js +6 -5
  81. package/lib/react-native/OfflineQuery.js +3 -2
  82. package/lib/react-native/Parse.js +23 -7
  83. package/lib/react-native/ParseACL.js +19 -11
  84. package/lib/react-native/ParseInstallation.js +115 -10
  85. package/lib/react-native/ParseLiveQuery.js +11 -2
  86. package/lib/react-native/ParseObject.js +28 -31
  87. package/lib/react-native/ParseOp.js +20 -6
  88. package/lib/react-native/ParseQuery.js +1 -0
  89. package/lib/react-native/ParseRelation.js +10 -7
  90. package/lib/react-native/ParseRole.js +2 -0
  91. package/lib/react-native/ParseUser.js +6 -2
  92. package/lib/react-native/RESTController.js +5 -5
  93. package/lib/react-native/SingleInstanceStateController.js +0 -2
  94. package/lib/react-native/Storage.js +1 -2
  95. package/lib/react-native/StorageController.js +1 -0
  96. package/lib/react-native/WebSocketController.js +5 -0
  97. package/lib/react-native/arrayContainsObject.js +3 -2
  98. package/lib/react-native/canBeSerialized.js +5 -3
  99. package/lib/react-native/decode.js +7 -5
  100. package/lib/react-native/encode.js +6 -4
  101. package/lib/react-native/equals.js +4 -3
  102. package/lib/react-native/unique.js +3 -2
  103. package/lib/react-native/unsavedChildren.js +3 -2
  104. package/lib/react-native/uuid.js +9 -4
  105. package/lib/weapp/CoreManager.js +48 -171
  106. package/lib/weapp/InstallationController.js +134 -23
  107. package/lib/weapp/LiveQueryClient.js +43 -35
  108. package/lib/weapp/LiveQuerySubscription.js +15 -5
  109. package/lib/weapp/LocalDatastoreController.default.js +248 -0
  110. package/lib/weapp/LocalDatastoreController.js +1 -246
  111. package/lib/weapp/ObjectStateMutations.js +6 -5
  112. package/lib/weapp/OfflineQuery.js +3 -2
  113. package/lib/weapp/Parse.js +31 -7
  114. package/lib/weapp/ParseACL.js +21 -11
  115. package/lib/weapp/ParseFile.js +4 -0
  116. package/lib/weapp/ParseHooks.js +2 -0
  117. package/lib/weapp/ParseInstallation.js +274 -13
  118. package/lib/weapp/ParseLiveQuery.js +32 -23
  119. package/lib/weapp/ParseObject.js +37 -40
  120. package/lib/weapp/ParseOp.js +21 -7
  121. package/lib/weapp/ParseQuery.js +1 -0
  122. package/lib/weapp/ParseRelation.js +12 -7
  123. package/lib/weapp/ParseRole.js +2 -0
  124. package/lib/weapp/ParseSession.js +1 -1
  125. package/lib/weapp/ParseUser.js +51 -15
  126. package/lib/weapp/RESTController.js +6 -5
  127. package/lib/weapp/SingleInstanceStateController.js +2 -4
  128. package/lib/weapp/Storage.js +1 -2
  129. package/lib/weapp/StorageController.js +3 -0
  130. package/lib/weapp/WebSocketController.js +13 -0
  131. package/lib/weapp/arrayContainsObject.js +4 -3
  132. package/lib/weapp/canBeSerialized.js +6 -4
  133. package/lib/weapp/decode.js +8 -5
  134. package/lib/weapp/encode.js +6 -4
  135. package/lib/weapp/equals.js +4 -3
  136. package/lib/weapp/unique.js +3 -2
  137. package/lib/weapp/unsavedChildren.js +4 -2
  138. package/lib/weapp/uuid.js +12 -5
  139. package/package.json +3 -1
@@ -7,12 +7,16 @@ _Object$defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
9
  exports.default = void 0;
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
11
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
10
12
  var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
11
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
12
13
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
15
+ var _get2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/get"));
13
16
  var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
14
17
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
15
18
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
19
+ var _CoreManager = _interopRequireDefault(require("./CoreManager"));
16
20
  var _ParseObject2 = _interopRequireDefault(require("./ParseObject"));
17
21
  function _createSuper(Derived) {
18
22
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
@@ -38,25 +42,282 @@ function _isNativeReflectConstruct() {
38
42
  } catch (e) {
39
43
  return false;
40
44
  }
41
- } /**
42
- * @flow
45
+ }
46
+ var DEVICE_TYPES /*: DeviceInterface*/ = {
47
+ IOS: 'ios',
48
+ MACOS: 'macos',
49
+ TVOS: 'tvos',
50
+ FCM: 'fcm',
51
+ ANDROID: 'android',
52
+ WEB: 'web'
53
+ };
54
+
55
+ /**
56
+ * Parse.Installation is a local representation of installation data that can be saved and retrieved from the Parse cloud.
57
+ * This class is a subclass of a Parse.Object, and retains the same functionality of a Parse.Object, but also extends it with installation-specific features.
58
+ *
59
+ * <p>A valid Parse.Installation can only be instantiated via <code>Parse.Installation.currentInstallation()</code>
60
+ *
61
+ * Parse.Installation objects which have a valid <code>deviceToken</code> and are saved to the Parse cloud can be used to target push notifications.
62
+ * </p>
63
+ *
64
+ * @alias Parse.Installation
65
+ */
66
+ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
67
+ (0, _inherits2.default)(ParseInstallation, _ParseObject);
68
+ var _super = _createSuper(ParseInstallation);
69
+ /**
70
+ * @param {object} attributes The initial set of data to store in the object.
43
71
  */
44
- /*:: import type { AttributeMap } from './ObjectStateMutations';*/
45
- var Installation = /*#__PURE__*/function (_ParseObject) {
46
- (0, _inherits2.default)(Installation, _ParseObject);
47
- var _super = _createSuper(Installation);
48
- function Installation(attributes /*: ?AttributeMap*/) {
72
+ function ParseInstallation(attributes /*:: ?: AttributeMap*/) {
49
73
  var _this;
50
- (0, _classCallCheck2.default)(this, Installation);
74
+ (0, _classCallCheck2.default)(this, ParseInstallation);
51
75
  _this = _super.call(this, '_Installation');
52
76
  if (attributes && (0, _typeof2.default)(attributes) === 'object') {
53
- if (!_this.set(attributes || {})) {
77
+ if (!_this.set(attributes)) {
54
78
  throw new Error("Can't create an invalid Installation");
55
79
  }
56
80
  }
57
81
  return _this;
58
82
  }
59
- return (0, _createClass2.default)(Installation);
83
+
84
+ /**
85
+ * A unique identifier for this installation’s client application. In iOS, this is the Bundle Identifier.
86
+ *
87
+ * @property {string} appIdentifier
88
+ * @static
89
+ */
90
+ (0, _createClass2.default)(ParseInstallation, [{
91
+ key: "appIdentifier",
92
+ get: function () {
93
+ return this.get('appIdentifier');
94
+ }
95
+
96
+ /**
97
+ * The version string of the client application to which this installation belongs.
98
+ *
99
+ * @property {string} appVersion
100
+ * @static
101
+ */
102
+ }, {
103
+ key: "appVersion",
104
+ get: function () {
105
+ return this.get('appVersion');
106
+ }
107
+
108
+ /**
109
+ * The display name of the client application to which this installation belongs.
110
+ *
111
+ * @property {string} appName
112
+ * @static
113
+ */
114
+ }, {
115
+ key: "appName",
116
+ get: function () {
117
+ return this.get('appName');
118
+ }
119
+
120
+ /**
121
+ * The current value of the icon badge for iOS apps.
122
+ * Changes to this value on the server will be used
123
+ * for future badge-increment push notifications.
124
+ *
125
+ * @property {number} badge
126
+ * @static
127
+ */
128
+ }, {
129
+ key: "badge",
130
+ get: function () {
131
+ return this.get('badge');
132
+ }
133
+
134
+ /**
135
+ * An array of the channels to which a device is currently subscribed.
136
+ *
137
+ * @property {string[]} channels
138
+ * @static
139
+ */
140
+ }, {
141
+ key: "channels",
142
+ get: function () {
143
+ return this.get('channels');
144
+ }
145
+
146
+ /**
147
+ * Token used to deliver push notifications to the device.
148
+ *
149
+ * @property {string} deviceToken
150
+ * @static
151
+ */
152
+ }, {
153
+ key: "deviceToken",
154
+ get: function () {
155
+ return this.get('deviceToken');
156
+ }
157
+
158
+ /**
159
+ * The type of device, “ios”, “android”, “web”, etc.
160
+ *
161
+ * @property {string} deviceType
162
+ * @static
163
+ */
164
+ }, {
165
+ key: "deviceType",
166
+ get: function () {
167
+ return this.get('deviceType');
168
+ }
169
+
170
+ /**
171
+ * Gets the GCM sender identifier for this installation
172
+ *
173
+ * @property {string} GCMSenderId
174
+ * @static
175
+ */
176
+ }, {
177
+ key: "GCMSenderId",
178
+ get: function () {
179
+ return this.get('GCMSenderId');
180
+ }
181
+
182
+ /**
183
+ * Universally Unique Identifier (UUID) for the device used by Parse. It must be unique across all of an app’s installations.
184
+ *
185
+ * @property {string} installationId
186
+ * @static
187
+ */
188
+ }, {
189
+ key: "installationId",
190
+ get: function () {
191
+ return this.get('installationId');
192
+ }
193
+
194
+ /**
195
+ * Gets the local identifier for this installation
196
+ *
197
+ * @property {string} localeIdentifier
198
+ * @static
199
+ */
200
+ }, {
201
+ key: "localeIdentifier",
202
+ get: function () {
203
+ return this.get('localeIdentifier');
204
+ }
205
+
206
+ /**
207
+ * Gets the parse server version for this installation
208
+ *
209
+ * @property {string} parseVersion
210
+ * @static
211
+ */
212
+ }, {
213
+ key: "parseVersion",
214
+ get: function () {
215
+ return this.get('parseVersion');
216
+ }
217
+
218
+ /**
219
+ * This field is reserved for directing Parse to the push delivery network to be used.
220
+ *
221
+ * @property {string} pushType
222
+ * @static
223
+ */
224
+ }, {
225
+ key: "pushType",
226
+ get: function () {
227
+ return this.get('pushType');
228
+ }
229
+
230
+ /**
231
+ * Gets the time zone for this installation
232
+ *
233
+ * @property {string} timeZone
234
+ * @static
235
+ */
236
+ }, {
237
+ key: "timeZone",
238
+ get: function () {
239
+ return this.get('timeZone');
240
+ }
241
+
242
+ /**
243
+ * Returns the device types for used for Push Notifications.
244
+ *
245
+ * <pre>
246
+ * Parse.Installation.DEVICE_TYPES.IOS
247
+ * Parse.Installation.DEVICE_TYPES.MACOS
248
+ * Parse.Installation.DEVICE_TYPES.TVOS
249
+ * Parse.Installation.DEVICE_TYPES.FCM
250
+ * Parse.Installation.DEVICE_TYPES.ANDROID
251
+ * Parse.Installation.DEVICE_TYPES.WEB
252
+ * </pre
253
+ *
254
+ * @property {Object} DEVICE_TYPES
255
+ * @static
256
+ */
257
+ }, {
258
+ key: "save",
259
+ value:
260
+ /**
261
+ * Wrap the default save behavior with functionality to save to local storage.
262
+ *
263
+ * @param {...any} args
264
+ * @returns {Promise}
265
+ */
266
+ function () {
267
+ var _save = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
268
+ var _len,
269
+ args,
270
+ _key,
271
+ _args = arguments;
272
+ return _regenerator.default.wrap(function (_context) {
273
+ while (1) switch (_context.prev = _context.next) {
274
+ case 0:
275
+ for (_len = _args.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
276
+ args[_key] = _args[_key];
277
+ }
278
+ _context.next = 3;
279
+ return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseInstallation.prototype), "save", this).apply(this, args);
280
+ case 3:
281
+ _context.next = 5;
282
+ return _CoreManager.default.getInstallationController().updateInstallationOnDisk(this);
283
+ case 5:
284
+ return _context.abrupt("return", this);
285
+ case 6:
286
+ case "end":
287
+ return _context.stop();
288
+ }
289
+ }, _callee, this);
290
+ }));
291
+ function save() {
292
+ return _save.apply(this, arguments);
293
+ }
294
+ return save;
295
+ }()
296
+ /**
297
+ * Get the current Parse.Installation from disk. If doesn't exists, create an new installation.
298
+ *
299
+ * <pre>
300
+ * const installation = await Parse.Installation.currentInstallation();
301
+ * installation.set('deviceToken', '123');
302
+ * await installation.save();
303
+ * </pre>
304
+ *
305
+ * @returns {Promise} A promise that resolves to the local installation object.
306
+ */
307
+ }], [{
308
+ key: "DEVICE_TYPES",
309
+ get: function () /*: DeviceInterface*/{
310
+ return DEVICE_TYPES;
311
+ }
312
+ }, {
313
+ key: "currentInstallation",
314
+ value: function () /*: Promise<ParseInstallation>*/{
315
+ return _CoreManager.default.getInstallationController().currentInstallation();
316
+ }
317
+ }]);
318
+ return ParseInstallation;
60
319
  }(_ParseObject2.default);
61
- exports.default = Installation;
62
- _ParseObject2.default.registerSubclass('_Installation', Installation);
320
+ _ParseObject2.default.registerSubclass('_Installation', ParseInstallation);
321
+ module.exports = ParseInstallation;
322
+ var _default = ParseInstallation;
323
+ exports.default = _default;
@@ -6,9 +6,10 @@ _Object$defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
10
+ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
9
11
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
10
12
  var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
11
- var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
12
13
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
13
14
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
14
15
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
@@ -52,12 +53,20 @@ function getLiveQueryClient() /*: Promise<LiveQueryClient>*/{
52
53
  */
53
54
  var LiveQuery = /*#__PURE__*/function () {
54
55
  function LiveQuery() {
56
+ var _this = this;
55
57
  (0, _classCallCheck2.default)(this, LiveQuery);
56
58
  var EventEmitter = _CoreManager.default.getEventEmitter();
57
59
  this.emitter = new EventEmitter();
58
- this.on = this.emitter.on;
59
- this.emit = this.emitter.emit;
60
-
60
+ this.on = function (eventName, listener) {
61
+ return _this.emitter.on(eventName, listener);
62
+ };
63
+ this.emit = function (eventName) {
64
+ var _this$emitter, _context;
65
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
66
+ args[_key - 1] = arguments[_key];
67
+ }
68
+ return (_this$emitter = _this.emitter).emit.apply(_this$emitter, (0, _concat.default)(_context = [eventName]).call(_context, args));
69
+ };
61
70
  // adding listener so process does not crash
62
71
  // best practice is for developer to register their own listener
63
72
  this.on('error', function () {});
@@ -72,17 +81,17 @@ var LiveQuery = /*#__PURE__*/function () {
72
81
  value: function () {
73
82
  var _open = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
74
83
  var liveQueryClient;
75
- return _regenerator.default.wrap(function (_context) {
76
- while (1) switch (_context.prev = _context.next) {
84
+ return _regenerator.default.wrap(function (_context2) {
85
+ while (1) switch (_context2.prev = _context2.next) {
77
86
  case 0:
78
- _context.next = 2;
87
+ _context2.next = 2;
79
88
  return getLiveQueryClient();
80
89
  case 2:
81
- liveQueryClient = _context.sent;
90
+ liveQueryClient = _context2.sent;
82
91
  liveQueryClient.open();
83
92
  case 4:
84
93
  case "end":
85
- return _context.stop();
94
+ return _context2.stop();
86
95
  }
87
96
  }, _callee);
88
97
  }));
@@ -103,17 +112,17 @@ var LiveQuery = /*#__PURE__*/function () {
103
112
  value: function () {
104
113
  var _close = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
105
114
  var liveQueryClient;
106
- return _regenerator.default.wrap(function (_context2) {
107
- while (1) switch (_context2.prev = _context2.next) {
115
+ return _regenerator.default.wrap(function (_context3) {
116
+ while (1) switch (_context3.prev = _context3.next) {
108
117
  case 0:
109
- _context2.next = 2;
118
+ _context3.next = 2;
110
119
  return getLiveQueryClient();
111
120
  case 2:
112
- liveQueryClient = _context2.sent;
121
+ liveQueryClient = _context3.sent;
113
122
  liveQueryClient.close();
114
123
  case 4:
115
124
  case "end":
116
- return _context2.stop();
125
+ return _context3.stop();
117
126
  }
118
127
  }, _callee2);
119
128
  }));
@@ -135,26 +144,26 @@ var DefaultLiveQueryController = {
135
144
  getDefaultLiveQueryClient: function () /*: Promise<LiveQueryClient>*/{
136
145
  return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
137
146
  var _yield$Promise$all, _yield$Promise$all2, currentUser, installationId, sessionToken, liveQueryServerURL, serverURL, protocol, host, applicationId, javascriptKey, masterKey, LiveQuery;
138
- return _regenerator.default.wrap(function (_context3) {
139
- while (1) switch (_context3.prev = _context3.next) {
147
+ return _regenerator.default.wrap(function (_context4) {
148
+ while (1) switch (_context4.prev = _context4.next) {
140
149
  case 0:
141
150
  if (!defaultLiveQueryClient) {
142
- _context3.next = 2;
151
+ _context4.next = 2;
143
152
  break;
144
153
  }
145
- return _context3.abrupt("return", defaultLiveQueryClient);
154
+ return _context4.abrupt("return", defaultLiveQueryClient);
146
155
  case 2:
147
- _context3.next = 4;
156
+ _context4.next = 4;
148
157
  return _promise.default.all([_CoreManager.default.getUserController().currentUserAsync(), _CoreManager.default.getInstallationController().currentInstallationId()]);
149
158
  case 4:
150
- _yield$Promise$all = _context3.sent;
159
+ _yield$Promise$all = _context4.sent;
151
160
  _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 2);
152
161
  currentUser = _yield$Promise$all2[0];
153
162
  installationId = _yield$Promise$all2[1];
154
163
  sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
155
164
  liveQueryServerURL = _CoreManager.default.get('LIVEQUERY_SERVER_URL');
156
165
  if (!(liveQueryServerURL && (0, _indexOf.default)(liveQueryServerURL).call(liveQueryServerURL, 'ws') !== 0)) {
157
- _context3.next = 12;
166
+ _context4.next = 12;
158
167
  break;
159
168
  }
160
169
  throw new Error('You need to set a proper Parse LiveQuery server url before using LiveQueryClient');
@@ -188,10 +197,10 @@ var DefaultLiveQueryController = {
188
197
  defaultLiveQueryClient.on('close', function () {
189
198
  LiveQuery.emit('close');
190
199
  });
191
- return _context3.abrupt("return", defaultLiveQueryClient);
200
+ return _context4.abrupt("return", defaultLiveQueryClient);
192
201
  case 22:
193
202
  case "end":
194
- return _context3.stop();
203
+ return _context4.stop();
195
204
  }
196
205
  }, _callee3);
197
206
  }))();
@@ -46,7 +46,6 @@ var _canBeSerialized = _interopRequireDefault(require("./canBeSerialized"));
46
46
  var _decode = _interopRequireDefault(require("./decode"));
47
47
  var _encode = _interopRequireDefault(require("./encode"));
48
48
  var _escape2 = _interopRequireDefault(require("./escape"));
49
- var _EventuallyQueue = _interopRequireDefault(require("./EventuallyQueue"));
50
49
  var _ParseACL = _interopRequireDefault(require("./ParseACL"));
51
50
  var _parseDate = _interopRequireDefault(require("./parseDate"));
52
51
  var _ParseError = _interopRequireDefault(require("./ParseError"));
@@ -54,7 +53,6 @@ var _ParseFile = _interopRequireDefault(require("./ParseFile"));
54
53
  var _promiseUtils = require("./promiseUtils");
55
54
  var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
56
55
  var _ParseOp = require("./ParseOp");
57
- var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
58
56
  var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
59
57
  var SingleInstanceStateController = _interopRequireWildcard(require("./SingleInstanceStateController"));
60
58
  var _unique = _interopRequireDefault(require("./unique"));
@@ -624,10 +622,6 @@ var ParseObject = /*#__PURE__*/function () {
624
622
  json[_attr5] = (0, _encode.default)(attrs[_attr5], false, false, seen, offline);
625
623
  }
626
624
  }
627
- var pending = this._getPendingOps();
628
- for (var _attr6 in pending[0]) {
629
- json[_attr6] = pending[0][_attr6].toJSON(offline);
630
- }
631
625
  if (this.id) {
632
626
  json.objectId = this.id;
633
627
  }
@@ -696,13 +690,13 @@ var ParseObject = /*#__PURE__*/function () {
696
690
  var pendingOps = this._getPendingOps();
697
691
  var keys = {};
698
692
  for (var i = 0; i < pendingOps.length; i++) {
699
- for (var _attr7 in pendingOps[i]) {
700
- keys[_attr7] = true;
693
+ for (var _attr6 in pendingOps[i]) {
694
+ keys[_attr6] = true;
701
695
  }
702
696
  }
703
697
  var dirtyObjects = this._getDirtyObjectAttributes();
704
- for (var _attr8 in dirtyObjects) {
705
- keys[_attr8] = true;
698
+ for (var _attr7 in dirtyObjects) {
699
+ keys[_attr7] = true;
706
700
  }
707
701
  return (0, _keys.default)(keys);
708
702
  }
@@ -907,11 +901,11 @@ var ParseObject = /*#__PURE__*/function () {
907
901
 
908
902
  // Calculate new values
909
903
  var newValues = {};
910
- for (var _attr9 in newOps) {
911
- if (newOps[_attr9] instanceof _ParseOp.RelationOp) {
912
- newValues[_attr9] = newOps[_attr9].applyTo(currentAttributes[_attr9], this, _attr9);
913
- } else if (!(newOps[_attr9] instanceof _ParseOp.UnsetOp)) {
914
- newValues[_attr9] = newOps[_attr9].applyTo(currentAttributes[_attr9]);
904
+ for (var _attr8 in newOps) {
905
+ if (newOps[_attr8] instanceof _ParseOp.RelationOp) {
906
+ newValues[_attr8] = newOps[_attr8].applyTo(currentAttributes[_attr8], this, _attr8);
907
+ } else if (!(newOps[_attr8] instanceof _ParseOp.UnsetOp)) {
908
+ newValues[_attr8] = newOps[_attr8].applyTo(currentAttributes[_attr8]);
915
909
  }
916
910
  }
917
911
 
@@ -930,9 +924,9 @@ var ParseObject = /*#__PURE__*/function () {
930
924
  var pendingOps = this._getPendingOps();
931
925
  var last = pendingOps.length - 1;
932
926
  var stateController = _CoreManager.default.getObjectStateController();
933
- for (var _attr10 in newOps) {
934
- var nextOp = newOps[_attr10].mergeWith(pendingOps[last][_attr10]);
935
- stateController.setPendingOp(this._getStateIdentifier(), _attr10, nextOp);
927
+ for (var _attr9 in newOps) {
928
+ var nextOp = newOps[_attr9].mergeWith(pendingOps[last][_attr9]);
929
+ stateController.setPendingOp(this._getStateIdentifier(), _attr9, nextOp);
936
930
  }
937
931
  return this;
938
932
  }
@@ -1196,7 +1190,7 @@ var ParseObject = /*#__PURE__*/function () {
1196
1190
  key: "exists",
1197
1191
  value: function () {
1198
1192
  var _exists = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(options /*:: ?: RequestOptions*/) {
1199
- var query;
1193
+ var ParseQuery, query;
1200
1194
  return _regenerator.default.wrap(function (_context) {
1201
1195
  while (1) switch (_context.prev = _context.next) {
1202
1196
  case 0:
@@ -1207,26 +1201,27 @@ var ParseObject = /*#__PURE__*/function () {
1207
1201
  return _context.abrupt("return", false);
1208
1202
  case 2:
1209
1203
  _context.prev = 2;
1210
- query = new _ParseQuery.default(this.className);
1211
- _context.next = 6;
1204
+ ParseQuery = _CoreManager.default.getParseQuery();
1205
+ query = new ParseQuery(this.className);
1206
+ _context.next = 7;
1212
1207
  return query.get(this.id, options);
1213
- case 6:
1208
+ case 7:
1214
1209
  return _context.abrupt("return", true);
1215
- case 9:
1216
- _context.prev = 9;
1210
+ case 10:
1211
+ _context.prev = 10;
1217
1212
  _context.t0 = _context["catch"](2);
1218
1213
  if (!(_context.t0.code === _ParseError.default.OBJECT_NOT_FOUND)) {
1219
- _context.next = 13;
1214
+ _context.next = 14;
1220
1215
  break;
1221
1216
  }
1222
1217
  return _context.abrupt("return", false);
1223
- case 13:
1224
- throw _context.t0;
1225
1218
  case 14:
1219
+ throw _context.t0;
1220
+ case 15:
1226
1221
  case "end":
1227
1222
  return _context.stop();
1228
1223
  }
1229
- }, _callee, this, [[2, 9]]);
1224
+ }, _callee, this, [[2, 10]]);
1230
1225
  }));
1231
1226
  function exists() {
1232
1227
  return _exists.apply(this, arguments);
@@ -1346,9 +1341,9 @@ var ParseObject = /*#__PURE__*/function () {
1346
1341
  if (typeof this.constructor.readOnlyAttributes === 'function') {
1347
1342
  readonly = (0, _concat.default)(readonly).call(readonly, this.constructor.readOnlyAttributes());
1348
1343
  }
1349
- for (var _attr11 in attributes) {
1350
- if ((0, _indexOf.default)(readonly).call(readonly, _attr11) < 0) {
1351
- erasable[_attr11] = true;
1344
+ for (var _attr10 in attributes) {
1345
+ if ((0, _indexOf.default)(readonly).call(readonly, _attr10) < 0) {
1346
+ erasable[_attr10] = true;
1352
1347
  }
1353
1348
  }
1354
1349
  return this.set(erasable, {
@@ -1478,9 +1473,9 @@ var ParseObject = /*#__PURE__*/function () {
1478
1473
  break;
1479
1474
  }
1480
1475
  _context4.next = 10;
1481
- return _EventuallyQueue.default.save(this, options);
1476
+ return _CoreManager.default.getEventuallyQueue().save(this, options);
1482
1477
  case 10:
1483
- _EventuallyQueue.default.poll();
1478
+ _CoreManager.default.getEventuallyQueue().poll();
1484
1479
  case 11:
1485
1480
  return _context4.abrupt("return", this);
1486
1481
  case 12:
@@ -1647,9 +1642,9 @@ var ParseObject = /*#__PURE__*/function () {
1647
1642
  break;
1648
1643
  }
1649
1644
  _context5.next = 10;
1650
- return _EventuallyQueue.default.destroy(this, options);
1645
+ return _CoreManager.default.getEventuallyQueue().destroy(this, options);
1651
1646
  case 10:
1652
- _EventuallyQueue.default.poll();
1647
+ _CoreManager.default.getEventuallyQueue().poll();
1653
1648
  case 11:
1654
1649
  return _context5.abrupt("return", this);
1655
1650
  case 12:
@@ -2194,11 +2189,11 @@ var ParseObject = /*#__PURE__*/function () {
2194
2189
  var constructor = classMap[json.className];
2195
2190
  var o = constructor ? new constructor(json.className) : new ParseObject(json.className);
2196
2191
  var otherAttributes = {};
2197
- for (var _attr12 in json) {
2198
- if (_attr12 !== 'className' && _attr12 !== '__type') {
2199
- otherAttributes[_attr12] = json[_attr12];
2192
+ for (var _attr11 in json) {
2193
+ if (_attr11 !== 'className' && _attr11 !== '__type') {
2194
+ otherAttributes[_attr11] = json[_attr11];
2200
2195
  if (dirty) {
2201
- o.set(_attr12, json[_attr12]);
2196
+ o.set(_attr11, json[_attr11]);
2202
2197
  }
2203
2198
  }
2204
2199
  }
@@ -2613,7 +2608,8 @@ var DefaultController = {
2613
2608
  if (error) {
2614
2609
  return _promise.default.reject(error);
2615
2610
  }
2616
- var query = new _ParseQuery.default(className);
2611
+ var ParseQuery = _CoreManager.default.getParseQuery();
2612
+ var query = new ParseQuery(className);
2617
2613
  query.containedIn('objectId', ids);
2618
2614
  if (options && options.include) {
2619
2615
  query.include(options.include);
@@ -3045,6 +3041,7 @@ var DefaultController = {
3045
3041
  return _promise.default.resolve();
3046
3042
  }
3047
3043
  };
3044
+ _CoreManager.default.setParseObject(ParseObject);
3048
3045
  _CoreManager.default.setObjectController(DefaultController);
3049
3046
  var _default = ParseObject;
3050
3047
  exports.default = _default;