parse 5.1.1-alpha.1 → 5.2.0-alpha.2

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 (249) hide show
  1. package/dist/parse.js +10186 -14918
  2. package/dist/parse.min.js +2 -2
  3. package/dist/parse.weapp.js +10180 -15057
  4. package/dist/parse.weapp.min.js +2 -2
  5. package/lib/browser/Analytics.js +7 -11
  6. package/lib/browser/AnonymousUtils.js +17 -22
  7. package/lib/browser/Cloud.js +24 -46
  8. package/lib/browser/CoreManager.js +71 -79
  9. package/lib/browser/CryptoController.js +14 -9
  10. package/lib/browser/EventEmitter.js +9 -2
  11. package/lib/browser/EventuallyQueue.js +156 -357
  12. package/lib/browser/FacebookUtils.js +23 -28
  13. package/lib/browser/IndexedDBStorageController.js +18 -14
  14. package/lib/browser/InstallationController.js +55 -121
  15. package/lib/browser/LiveQueryClient.js +312 -446
  16. package/lib/browser/LiveQuerySubscription.js +25 -28
  17. package/lib/browser/LocalDatastore.js +254 -578
  18. package/lib/browser/LocalDatastoreController.default.js +48 -227
  19. package/lib/browser/LocalDatastoreController.js +11 -1
  20. package/lib/browser/LocalDatastoreController.react-native.js +72 -164
  21. package/lib/browser/LocalDatastoreUtils.js +4 -12
  22. package/lib/browser/ObjectStateMutations.js +89 -95
  23. package/lib/browser/OfflineQuery.js +106 -198
  24. package/lib/browser/Parse.js +45 -61
  25. package/lib/browser/ParseACL.js +242 -288
  26. package/lib/browser/ParseCLP.js +372 -580
  27. package/lib/browser/ParseConfig.js +115 -138
  28. package/lib/browser/ParseError.js +85 -182
  29. package/lib/browser/ParseFile.js +296 -444
  30. package/lib/browser/ParseGeoPoint.js +121 -140
  31. package/lib/browser/ParseHooks.js +12 -14
  32. package/lib/browser/ParseInstallation.js +226 -354
  33. package/lib/browser/ParseLiveQuery.js +74 -148
  34. package/lib/browser/ParseObject.js +2017 -2622
  35. package/lib/browser/ParseOp.js +343 -484
  36. package/lib/browser/ParsePolygon.js +101 -120
  37. package/lib/browser/ParseQuery.js +1722 -2068
  38. package/lib/browser/ParseRelation.js +99 -118
  39. package/lib/browser/ParseRole.js +88 -144
  40. package/lib/browser/ParseSchema.js +372 -434
  41. package/lib/browser/ParseSession.js +62 -110
  42. package/lib/browser/ParseUser.js +942 -1270
  43. package/lib/browser/Push.js +16 -44
  44. package/lib/browser/RESTController.js +85 -124
  45. package/lib/browser/SingleInstanceStateController.js +57 -86
  46. package/lib/browser/Socket.weapp.js +50 -33
  47. package/lib/browser/Storage.js +23 -28
  48. package/lib/browser/StorageController.browser.js +16 -13
  49. package/lib/browser/StorageController.default.js +15 -14
  50. package/lib/browser/StorageController.js +14 -1
  51. package/lib/browser/StorageController.react-native.js +31 -30
  52. package/lib/browser/StorageController.weapp.js +19 -13
  53. package/lib/browser/TaskQueue.js +37 -49
  54. package/lib/browser/UniqueInstanceStateController.js +65 -86
  55. package/lib/browser/WebSocketController.js +11 -4
  56. package/lib/browser/Xhr.weapp.js +90 -78
  57. package/lib/browser/arrayContainsObject.js +3 -3
  58. package/lib/browser/canBeSerialized.js +10 -11
  59. package/lib/browser/decode.js +11 -11
  60. package/lib/browser/encode.js +11 -11
  61. package/lib/browser/equals.js +9 -10
  62. package/lib/browser/escape.js +2 -2
  63. package/lib/browser/isRevocableSession.js +1 -1
  64. package/lib/browser/parseDate.js +10 -10
  65. package/lib/browser/promiseUtils.js +19 -19
  66. package/lib/browser/unique.js +4 -4
  67. package/lib/browser/unsavedChildren.js +20 -21
  68. package/lib/browser/uuid.js +2 -4
  69. package/lib/node/Analytics.js +2 -6
  70. package/lib/node/AnonymousUtils.js +7 -12
  71. package/lib/node/Cloud.js +8 -12
  72. package/lib/node/CoreManager.js +59 -67
  73. package/lib/node/CryptoController.js +8 -3
  74. package/lib/node/EventEmitter.js +7 -1
  75. package/lib/node/EventuallyQueue.js +18 -37
  76. package/lib/node/FacebookUtils.js +1 -5
  77. package/lib/node/IndexedDBStorageController.js +14 -10
  78. package/lib/node/InstallationController.js +7 -8
  79. package/lib/node/LiveQueryClient.js +20 -32
  80. package/lib/node/LiveQuerySubscription.js +3 -4
  81. package/lib/node/LocalDatastore.js +20 -24
  82. package/lib/node/LocalDatastoreController.default.js +12 -11
  83. package/lib/node/LocalDatastoreController.js +14 -1
  84. package/lib/node/LocalDatastoreController.react-native.js +27 -22
  85. package/lib/node/LocalDatastoreUtils.js +4 -12
  86. package/lib/node/ObjectStateMutations.js +52 -36
  87. package/lib/node/OfflineQuery.js +37 -23
  88. package/lib/node/Parse.js +35 -49
  89. package/lib/node/ParseACL.js +18 -27
  90. package/lib/node/ParseCLP.js +38 -50
  91. package/lib/node/ParseConfig.js +7 -14
  92. package/lib/node/ParseError.js +457 -458
  93. package/lib/node/ParseFile.js +33 -66
  94. package/lib/node/ParseGeoPoint.js +22 -17
  95. package/lib/node/ParseHooks.js +0 -2
  96. package/lib/node/ParseInstallation.js +21 -8
  97. package/lib/node/ParseLiveQuery.js +6 -11
  98. package/lib/node/ParseObject.js +138 -167
  99. package/lib/node/ParseOp.js +32 -44
  100. package/lib/node/ParsePolygon.js +11 -17
  101. package/lib/node/ParseQuery.js +118 -164
  102. package/lib/node/ParseRelation.js +7 -16
  103. package/lib/node/ParseRole.js +7 -13
  104. package/lib/node/ParseSchema.js +26 -39
  105. package/lib/node/ParseSession.js +7 -8
  106. package/lib/node/ParseUser.js +70 -76
  107. package/lib/node/Push.js +5 -15
  108. package/lib/node/RESTController.js +21 -33
  109. package/lib/node/SingleInstanceStateController.js +41 -69
  110. package/lib/node/Socket.weapp.js +23 -2
  111. package/lib/node/Storage.js +11 -16
  112. package/lib/node/StorageController.browser.js +10 -8
  113. package/lib/node/StorageController.default.js +9 -9
  114. package/lib/node/StorageController.js +16 -1
  115. package/lib/node/StorageController.react-native.js +17 -17
  116. package/lib/node/StorageController.weapp.js +14 -8
  117. package/lib/node/TaskQueue.js +8 -11
  118. package/lib/node/UniqueInstanceStateController.js +40 -60
  119. package/lib/node/WebSocketController.js +15 -2
  120. package/lib/node/Xhr.weapp.js +11 -2
  121. package/lib/node/arrayContainsObject.js +1 -1
  122. package/lib/node/canBeSerialized.js +2 -2
  123. package/lib/node/decode.js +1 -1
  124. package/lib/node/encode.js +2 -2
  125. package/lib/node/equals.js +1 -1
  126. package/lib/node/escape.js +1 -1
  127. package/lib/node/isRevocableSession.js +1 -1
  128. package/lib/node/parseDate.js +1 -1
  129. package/lib/node/promiseUtils.js +7 -7
  130. package/lib/node/unique.js +2 -2
  131. package/lib/node/unsavedChildren.js +2 -2
  132. package/lib/node/uuid.js +2 -4
  133. package/lib/react-native/Analytics.js +2 -2
  134. package/lib/react-native/AnonymousUtils.js +3 -4
  135. package/lib/react-native/Cloud.js +0 -1
  136. package/lib/react-native/CoreManager.js +2 -3
  137. package/lib/react-native/CryptoController.js +6 -1
  138. package/lib/react-native/EventEmitter.js +6 -1
  139. package/lib/react-native/EventuallyQueue.js +1 -2
  140. package/lib/react-native/FacebookUtils.js +1 -2
  141. package/lib/react-native/IndexedDBStorageController.js +11 -5
  142. package/lib/react-native/InstallationController.js +1 -2
  143. package/lib/react-native/LiveQueryClient.js +51 -36
  144. package/lib/react-native/LiveQuerySubscription.js +2 -4
  145. package/lib/react-native/LocalDatastore.js +41 -17
  146. package/lib/react-native/LocalDatastoreController.default.js +6 -1
  147. package/lib/react-native/LocalDatastoreController.js +11 -1
  148. package/lib/react-native/LocalDatastoreController.react-native.js +16 -11
  149. package/lib/react-native/LocalDatastoreUtils.js +3 -6
  150. package/lib/react-native/ObjectStateMutations.js +30 -9
  151. package/lib/react-native/OfflineQuery.js +25 -20
  152. package/lib/react-native/Parse.js +24 -38
  153. package/lib/react-native/ParseACL.js +4 -6
  154. package/lib/react-native/ParseCLP.js +5 -7
  155. package/lib/react-native/ParseConfig.js +4 -6
  156. package/lib/react-native/ParseError.js +13 -31
  157. package/lib/react-native/ParseFile.js +10 -10
  158. package/lib/react-native/ParseGeoPoint.js +2 -4
  159. package/lib/react-native/ParseInstallation.js +13 -30
  160. package/lib/react-native/ParseLiveQuery.js +2 -4
  161. package/lib/react-native/ParseObject.js +81 -90
  162. package/lib/react-native/ParseOp.js +41 -79
  163. package/lib/react-native/ParsePolygon.js +2 -4
  164. package/lib/react-native/ParseQuery.js +87 -81
  165. package/lib/react-native/ParseRelation.js +2 -4
  166. package/lib/react-native/ParseRole.js +14 -31
  167. package/lib/react-native/ParseSchema.js +3 -5
  168. package/lib/react-native/ParseSession.js +12 -29
  169. package/lib/react-native/ParseUser.js +32 -51
  170. package/lib/react-native/RESTController.js +10 -4
  171. package/lib/react-native/SingleInstanceStateController.js +23 -37
  172. package/lib/react-native/Socket.weapp.js +9 -4
  173. package/lib/react-native/Storage.js +1 -2
  174. package/lib/react-native/StorageController.browser.js +6 -1
  175. package/lib/react-native/StorageController.default.js +6 -1
  176. package/lib/react-native/StorageController.js +13 -1
  177. package/lib/react-native/StorageController.react-native.js +11 -6
  178. package/lib/react-native/StorageController.weapp.js +6 -1
  179. package/lib/react-native/TaskQueue.js +8 -4
  180. package/lib/react-native/UniqueInstanceStateController.js +23 -37
  181. package/lib/react-native/WebSocketController.js +9 -1
  182. package/lib/react-native/Xhr.weapp.js +9 -4
  183. package/lib/react-native/unsavedChildren.js +3 -3
  184. package/lib/react-native/uuid.js +1 -2
  185. package/lib/weapp/Analytics.js +7 -11
  186. package/lib/weapp/AnonymousUtils.js +17 -22
  187. package/lib/weapp/Cloud.js +24 -46
  188. package/lib/weapp/CoreManager.js +71 -79
  189. package/lib/weapp/CryptoController.js +14 -9
  190. package/lib/weapp/EventEmitter.js +9 -2
  191. package/lib/weapp/EventuallyQueue.js +156 -357
  192. package/lib/weapp/FacebookUtils.js +23 -28
  193. package/lib/weapp/IndexedDBStorageController.js +18 -14
  194. package/lib/weapp/InstallationController.js +55 -121
  195. package/lib/weapp/LiveQueryClient.js +312 -446
  196. package/lib/weapp/LiveQuerySubscription.js +25 -28
  197. package/lib/weapp/LocalDatastore.js +254 -578
  198. package/lib/weapp/LocalDatastoreController.default.js +48 -227
  199. package/lib/weapp/LocalDatastoreController.js +11 -1
  200. package/lib/weapp/LocalDatastoreController.react-native.js +72 -164
  201. package/lib/weapp/LocalDatastoreUtils.js +4 -12
  202. package/lib/weapp/ObjectStateMutations.js +89 -95
  203. package/lib/weapp/OfflineQuery.js +106 -198
  204. package/lib/weapp/Parse.js +45 -60
  205. package/lib/weapp/ParseACL.js +242 -288
  206. package/lib/weapp/ParseCLP.js +372 -580
  207. package/lib/weapp/ParseConfig.js +115 -138
  208. package/lib/weapp/ParseError.js +85 -182
  209. package/lib/weapp/ParseFile.js +297 -446
  210. package/lib/weapp/ParseGeoPoint.js +121 -140
  211. package/lib/weapp/ParseHooks.js +12 -14
  212. package/lib/weapp/ParseInstallation.js +226 -354
  213. package/lib/weapp/ParseLiveQuery.js +74 -148
  214. package/lib/weapp/ParseObject.js +2017 -2622
  215. package/lib/weapp/ParseOp.js +343 -484
  216. package/lib/weapp/ParsePolygon.js +101 -120
  217. package/lib/weapp/ParseQuery.js +1722 -2068
  218. package/lib/weapp/ParseRelation.js +99 -118
  219. package/lib/weapp/ParseRole.js +88 -144
  220. package/lib/weapp/ParseSchema.js +372 -434
  221. package/lib/weapp/ParseSession.js +62 -110
  222. package/lib/weapp/ParseUser.js +942 -1270
  223. package/lib/weapp/Push.js +16 -44
  224. package/lib/weapp/RESTController.js +86 -125
  225. package/lib/weapp/SingleInstanceStateController.js +57 -86
  226. package/lib/weapp/Socket.weapp.js +50 -33
  227. package/lib/weapp/Storage.js +23 -28
  228. package/lib/weapp/StorageController.browser.js +16 -13
  229. package/lib/weapp/StorageController.default.js +15 -14
  230. package/lib/weapp/StorageController.js +14 -1
  231. package/lib/weapp/StorageController.react-native.js +31 -30
  232. package/lib/weapp/StorageController.weapp.js +19 -13
  233. package/lib/weapp/TaskQueue.js +37 -49
  234. package/lib/weapp/UniqueInstanceStateController.js +65 -86
  235. package/lib/weapp/WebSocketController.js +11 -4
  236. package/lib/weapp/Xhr.weapp.js +90 -78
  237. package/lib/weapp/arrayContainsObject.js +3 -3
  238. package/lib/weapp/canBeSerialized.js +10 -11
  239. package/lib/weapp/decode.js +11 -11
  240. package/lib/weapp/encode.js +11 -11
  241. package/lib/weapp/equals.js +9 -10
  242. package/lib/weapp/escape.js +2 -2
  243. package/lib/weapp/isRevocableSession.js +1 -1
  244. package/lib/weapp/parseDate.js +10 -10
  245. package/lib/weapp/promiseUtils.js +19 -19
  246. package/lib/weapp/unique.js +4 -4
  247. package/lib/weapp/unsavedChildren.js +20 -21
  248. package/lib/weapp/uuid.js +6 -8
  249. package/package.json +23 -30
@@ -22,61 +22,36 @@ var SingleInstanceStateController = _interopRequireWildcard(require("./SingleIns
22
22
  var _unique = _interopRequireDefault(require("./unique"));
23
23
  var UniqueInstanceStateController = _interopRequireWildcard(require("./UniqueInstanceStateController"));
24
24
  var _unsavedChildren = _interopRequireDefault(require("./unsavedChildren"));
25
- function _getRequireWildcardCache(nodeInterop) {
26
- if (typeof WeakMap !== "function") return null;
27
- var cacheBabelInterop = new WeakMap();
28
- var cacheNodeInterop = new WeakMap();
29
- return (_getRequireWildcardCache = function (nodeInterop) {
30
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
31
- })(nodeInterop);
25
+ function _getRequireWildcardCache(e) {
26
+ if ("function" != typeof WeakMap) return null;
27
+ var r = new WeakMap(),
28
+ t = new WeakMap();
29
+ return (_getRequireWildcardCache = function (e) {
30
+ return e ? t : r;
31
+ })(e);
32
32
  }
33
- function _interopRequireWildcard(obj, nodeInterop) {
34
- if (!nodeInterop && obj && obj.__esModule) {
35
- return obj;
36
- }
37
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
38
- return {
39
- default: obj
40
- };
41
- }
42
- var cache = _getRequireWildcardCache(nodeInterop);
43
- if (cache && cache.has(obj)) {
44
- return cache.get(obj);
45
- }
46
- var newObj = {};
47
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
48
- for (var key in obj) {
49
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
50
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
51
- if (desc && (desc.get || desc.set)) {
52
- Object.defineProperty(newObj, key, desc);
53
- } else {
54
- newObj[key] = obj[key];
55
- }
56
- }
57
- }
58
- newObj.default = obj;
59
- if (cache) {
60
- cache.set(obj, newObj);
61
- }
62
- return newObj;
33
+ function _interopRequireWildcard(e, r) {
34
+ if (!r && e && e.__esModule) return e;
35
+ if (null === e || "object" != typeof e && "function" != typeof e) return {
36
+ default: e
37
+ };
38
+ var t = _getRequireWildcardCache(r);
39
+ if (t && t.has(e)) return t.get(e);
40
+ var n = {
41
+ __proto__: null
42
+ },
43
+ a = Object.defineProperty && Object.getOwnPropertyDescriptor;
44
+ for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
45
+ var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
46
+ i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
47
+ }
48
+ return n.default = e, t && t.set(e, n), n;
63
49
  }
64
50
  function _interopRequireDefault(obj) {
65
51
  return obj && obj.__esModule ? obj : {
66
52
  default: obj
67
53
  };
68
54
  }
69
- /*:: export type Pointer = {
70
- __type: string,
71
- className: string,
72
- objectId?: string,
73
- _localId?: string,
74
- };*/
75
- /*:: export type SaveOptions = FullOptions & {
76
- cascadeSave?: boolean,
77
- context?: AttributeMap,
78
- batchSize?: number,
79
- };*/
80
55
  // Mapping of class names to constructors, so we can populate objects from the
81
56
  // server with appropriate subclasses of ParseObject
82
57
  const classMap = {};
@@ -124,8 +99,9 @@ class ParseObject {
124
99
  * @param {string} className The class name for the object
125
100
  * @param {object} attributes The initial set of data to store in the object.
126
101
  * @param {object} options The options for this object instance.
102
+ * @param {boolean} [options.ignoreValidation] Set to `true` ignore any attribute validation errors.
127
103
  */
128
- constructor(className /*:: ?: string | { className: string, [attr: string]: any }*/, attributes /*:: ?: { [attr: string]: any }*/, options /*:: ?: { ignoreValidation: boolean }*/) {
104
+ constructor(className, attributes, options) {
129
105
  // Enable legacy initializers
130
106
  if (typeof this.initialize === 'function') {
131
107
  this.initialize.apply(this, arguments);
@@ -162,7 +138,7 @@ class ParseObject {
162
138
 
163
139
  /* Prototype getters / setters */
164
140
 
165
- get attributes() /*: AttributeMap*/{
141
+ get attributes() {
166
142
  const stateController = _CoreManager.default.getObjectStateController();
167
143
  return Object.freeze(stateController.estimateAttributes(this._getStateIdentifier()));
168
144
  }
@@ -173,7 +149,7 @@ class ParseObject {
173
149
  * @property {Date} createdAt
174
150
  * @returns {Date}
175
151
  */
176
- get createdAt() /*: Date | undefined*/{
152
+ get createdAt() {
177
153
  return this._getServerData().createdAt;
178
154
  }
179
155
 
@@ -183,7 +159,7 @@ class ParseObject {
183
159
  * @property {Date} updatedAt
184
160
  * @returns {Date}
185
161
  */
186
- get updatedAt() /*: Date | undefined*/{
162
+ get updatedAt() {
187
163
  return this._getServerData().updatedAt;
188
164
  }
189
165
 
@@ -194,7 +170,7 @@ class ParseObject {
194
170
  *
195
171
  * @returns {string}
196
172
  */
197
- _getId() /*: string*/{
173
+ _getId() {
198
174
  if (typeof this.id === 'string') {
199
175
  return this.id;
200
176
  }
@@ -211,7 +187,7 @@ class ParseObject {
211
187
  *
212
188
  * @returns {Parse.Object|object}
213
189
  */
214
- _getStateIdentifier() /*: ParseObject | { id: string, className: string }*/{
190
+ _getStateIdentifier() {
215
191
  if (singleInstance) {
216
192
  let id = this.id;
217
193
  if (!id) {
@@ -225,7 +201,7 @@ class ParseObject {
225
201
  return this;
226
202
  }
227
203
  }
228
- _getServerData() /*: AttributeMap*/{
204
+ _getServerData() {
229
205
  const stateController = _CoreManager.default.getObjectStateController();
230
206
  return stateController.getServerData(this._getStateIdentifier());
231
207
  }
@@ -238,7 +214,7 @@ class ParseObject {
238
214
  const stateController = _CoreManager.default.getObjectStateController();
239
215
  stateController.setServerData(this._getStateIdentifier(), unset);
240
216
  }
241
- _getPendingOps() /*: Array<OpsMap>*/{
217
+ _getPendingOps() {
242
218
  const stateController = _CoreManager.default.getObjectStateController();
243
219
  return stateController.getPendingOps(this._getStateIdentifier());
244
220
  }
@@ -247,7 +223,7 @@ class ParseObject {
247
223
  * @param {Array<string>} [keysToClear] - if specified, only ops matching
248
224
  * these fields will be cleared
249
225
  */
250
- _clearPendingOps(keysToClear /*:: ?: Array<string>*/) {
226
+ _clearPendingOps(keysToClear) {
251
227
  const pending = this._getPendingOps();
252
228
  const latest = pending[pending.length - 1];
253
229
  const keys = keysToClear || Object.keys(latest);
@@ -255,7 +231,7 @@ class ParseObject {
255
231
  delete latest[key];
256
232
  });
257
233
  }
258
- _getDirtyObjectAttributes() /*: AttributeMap*/{
234
+ _getDirtyObjectAttributes() {
259
235
  const attributes = this.attributes;
260
236
  const stateController = _CoreManager.default.getObjectStateController();
261
237
  const objectCache = stateController.getObjectCache(this._getStateIdentifier());
@@ -280,13 +256,13 @@ class ParseObject {
280
256
  }
281
257
  return dirty;
282
258
  }
283
- _toFullJSON(seen /*:: ?: Array<any>*/, offline /*:: ?: boolean*/) /*: AttributeMap*/{
284
- const json /*: { [key: string]: any }*/ = this.toJSON(seen, offline);
259
+ _toFullJSON(seen, offline) {
260
+ const json = this.toJSON(seen, offline);
285
261
  json.__type = 'Object';
286
262
  json.className = this.className;
287
263
  return json;
288
264
  }
289
- _getSaveJSON() /*: AttributeMap*/{
265
+ _getSaveJSON() {
290
266
  const pending = this._getPendingOps();
291
267
  const dirtyObjects = this._getDirtyObjectAttributes();
292
268
  const json = {};
@@ -313,7 +289,7 @@ class ParseObject {
313
289
  }
314
290
  return json;
315
291
  }
316
- _getSaveParams() /*: SaveParams*/{
292
+ _getSaveParams() {
317
293
  let method = this.id ? 'PUT' : 'POST';
318
294
  const body = this._getSaveJSON();
319
295
  let path = 'classes/' + this.className;
@@ -336,19 +312,13 @@ class ParseObject {
336
312
  path
337
313
  };
338
314
  }
339
- _finishFetch(serverData /*: AttributeMap*/) {
315
+ _finishFetch(serverData) {
340
316
  if (!this.id && serverData.objectId) {
341
317
  this.id = serverData.objectId;
342
318
  }
343
319
  const stateController = _CoreManager.default.getObjectStateController();
344
320
  stateController.initializeState(this._getStateIdentifier());
345
- const decoded
346
- /*: Partial<{
347
- createdAt?: Date,
348
- updatedAt?: Date,
349
- ACL?: any,
350
- [key: string]: any,
351
- }>*/ = {};
321
+ const decoded = {};
352
322
  for (const attr in serverData) {
353
323
  if (attr === 'ACL') {
354
324
  decoded[attr] = new _ParseACL.default(serverData[attr]);
@@ -370,14 +340,14 @@ class ParseObject {
370
340
  }
371
341
  stateController.commitServerChanges(this._getStateIdentifier(), decoded);
372
342
  }
373
- _setExisted(existed /*: boolean*/) {
343
+ _setExisted(existed) {
374
344
  const stateController = _CoreManager.default.getObjectStateController();
375
345
  const state = stateController.getState(this._getStateIdentifier());
376
346
  if (state) {
377
347
  state.existed = existed;
378
348
  }
379
349
  }
380
- _migrateId(serverId /*: string*/) {
350
+ _migrateId(serverId) {
381
351
  if (this._localId && serverId) {
382
352
  if (singleInstance) {
383
353
  const stateController = _CoreManager.default.getObjectStateController();
@@ -393,13 +363,8 @@ class ParseObject {
393
363
  }
394
364
  }
395
365
  }
396
- _handleSaveResponse(response /*: AttributeMap*/, status /*: number*/) {
397
- const changes
398
- /*: Partial<{
399
- createdAt: string,
400
- updatedAt: string,
401
- [key: string]: any
402
- }>*/ = {};
366
+ _handleSaveResponse(response, status) {
367
+ const changes = {};
403
368
  const stateController = _CoreManager.default.getObjectStateController();
404
369
  const pending = stateController.popPendingState(this._getStateIdentifier());
405
370
  for (var attr in pending) {
@@ -460,10 +425,10 @@ class ParseObject {
460
425
  * @param offline
461
426
  * @returns {object}
462
427
  */
463
- toJSON(seen /*: Array<any> | void*/, offline /*:: ?: boolean*/) /*: AttributeMap*/{
428
+ toJSON(seen, offline) {
464
429
  const seenEntry = this.id ? this.className + ':' + this.id : this;
465
430
  seen = seen || [seenEntry];
466
- const json /*: AttributeMap*/ = {};
431
+ const json = {};
467
432
  const attrs = this.attributes;
468
433
  for (const attr in attrs) {
469
434
  if ((attr === 'createdAt' || attr === 'updatedAt') && attrs[attr].toJSON) {
@@ -472,6 +437,12 @@ class ParseObject {
472
437
  json[attr] = (0, _encode.default)(attrs[attr], false, false, seen, offline);
473
438
  }
474
439
  }
440
+ const pending = this._getPendingOps();
441
+ for (const attr in pending[0]) {
442
+ if (attr.indexOf('.') < 0) {
443
+ json[attr] = pending[0][attr].toJSON(offline);
444
+ }
445
+ }
475
446
  if (this.id) {
476
447
  json.objectId = this.id;
477
448
  }
@@ -484,7 +455,7 @@ class ParseObject {
484
455
  * @param {object} other - An other object ot compare
485
456
  * @returns {boolean}
486
457
  */
487
- equals(other /*: any*/) /*: boolean*/{
458
+ equals(other) {
488
459
  if (this === other) {
489
460
  return true;
490
461
  }
@@ -499,7 +470,7 @@ class ParseObject {
499
470
  * @param {string} attr An attribute name (optional).
500
471
  * @returns {boolean}
501
472
  */
502
- dirty(attr /*:: ?: string*/) /*: boolean*/{
473
+ dirty(attr) {
503
474
  if (!this.id) {
504
475
  return true;
505
476
  }
@@ -530,7 +501,7 @@ class ParseObject {
530
501
  *
531
502
  * @returns {string[]}
532
503
  */
533
- dirtyKeys() /*: Array<string>*/{
504
+ dirtyKeys() {
534
505
  const pendingOps = this._getPendingOps();
535
506
  const keys = {};
536
507
  for (let i = 0; i < pendingOps.length; i++) {
@@ -550,7 +521,7 @@ class ParseObject {
550
521
  *
551
522
  * @returns {boolean}
552
523
  */
553
- isDataAvailable() /*: boolean*/{
524
+ isDataAvailable() {
554
525
  const serverData = this._getServerData();
555
526
  return !!Object.keys(serverData).length;
556
527
  }
@@ -560,7 +531,7 @@ class ParseObject {
560
531
  *
561
532
  * @returns {Pointer}
562
533
  */
563
- toPointer() /*: Pointer*/{
534
+ toPointer() {
564
535
  if (!this.id) {
565
536
  throw new Error('Cannot create a pointer to an unsaved ParseObject');
566
537
  }
@@ -576,7 +547,7 @@ class ParseObject {
576
547
  *
577
548
  * @returns {Pointer}
578
549
  */
579
- toOfflinePointer() /*: Pointer*/{
550
+ toOfflinePointer() {
580
551
  if (!this._localId) {
581
552
  throw new Error('Cannot create a offline pointer to a saved ParseObject');
582
553
  }
@@ -593,7 +564,7 @@ class ParseObject {
593
564
  * @param {string} attr The string name of an attribute.
594
565
  * @returns {*}
595
566
  */
596
- get(attr /*: string*/) /*: any*/{
567
+ get(attr) {
597
568
  return this.attributes[attr];
598
569
  }
599
570
 
@@ -603,7 +574,7 @@ class ParseObject {
603
574
  * @param {string} attr The attribute to get the relation for.
604
575
  * @returns {Parse.Relation}
605
576
  */
606
- relation(attr /*: string*/) /*: ParseRelation*/{
577
+ relation(attr) {
607
578
  const value = this.get(attr);
608
579
  if (value) {
609
580
  if (!(value instanceof _ParseRelation.default)) {
@@ -621,7 +592,7 @@ class ParseObject {
621
592
  * @param {string} attr The string name of an attribute.
622
593
  * @returns {string}
623
594
  */
624
- escape(attr /*: string*/) /*: string*/{
595
+ escape(attr) {
625
596
  let val = this.attributes[attr];
626
597
  if (val == null) {
627
598
  return '';
@@ -642,7 +613,7 @@ class ParseObject {
642
613
  * @param {string} attr The string name of the attribute.
643
614
  * @returns {boolean}
644
615
  */
645
- has(attr /*: string*/) /*: boolean*/{
616
+ has(attr) {
646
617
  const attributes = this.attributes;
647
618
  if (attributes.hasOwnProperty(attr)) {
648
619
  return attributes[attr] != null;
@@ -680,7 +651,7 @@ class ParseObject {
680
651
  * The only supported option is <code>error</code>.
681
652
  * @returns {(ParseObject|boolean)} true if the set succeeded.
682
653
  */
683
- set(key /*: any*/, value /*:: ?: any*/, options /*:: ?: any*/) /*: ParseObject | boolean*/{
654
+ set(key, value, options) {
684
655
  let changes = {};
685
656
  const newOps = {};
686
657
  if (key && typeof key === 'object') {
@@ -767,7 +738,7 @@ class ParseObject {
767
738
  * @param options
768
739
  * @returns {(ParseObject | boolean)}
769
740
  */
770
- unset(attr /*: string*/, options /*:: ?: { [opt: string]: any }*/) /*: ParseObject | boolean*/{
741
+ unset(attr, options) {
771
742
  options = options || {};
772
743
  options.unset = true;
773
744
  return this.set(attr, null, options);
@@ -781,7 +752,7 @@ class ParseObject {
781
752
  * @param amount {Number} The amount to increment by (optional).
782
753
  * @returns {(ParseObject|boolean)}
783
754
  */
784
- increment(attr /*: string*/, amount /*:: ?: number*/) /*: ParseObject | boolean*/{
755
+ increment(attr, amount) {
785
756
  if (typeof amount === 'undefined') {
786
757
  amount = 1;
787
758
  }
@@ -799,7 +770,7 @@ class ParseObject {
799
770
  * @param amount {Number} The amount to decrement by (optional).
800
771
  * @returns {(ParseObject | boolean)}
801
772
  */
802
- decrement(attr /*: string*/, amount /*:: ?: number*/) /*: ParseObject | boolean*/{
773
+ decrement(attr, amount) {
803
774
  if (typeof amount === 'undefined') {
804
775
  amount = 1;
805
776
  }
@@ -817,7 +788,7 @@ class ParseObject {
817
788
  * @param item {} The item to add.
818
789
  * @returns {(ParseObject | boolean)}
819
790
  */
820
- add(attr /*: string*/, item /*: any*/) /*: ParseObject | boolean*/{
791
+ add(attr, item) {
821
792
  return this.set(attr, new _ParseOp.AddOp([item]));
822
793
  }
823
794
 
@@ -829,7 +800,7 @@ class ParseObject {
829
800
  * @param items {Object[]} The items to add.
830
801
  * @returns {(ParseObject | boolean)}
831
802
  */
832
- addAll(attr /*: string*/, items /*: Array<any>*/) /*: ParseObject | boolean*/{
803
+ addAll(attr, items) {
833
804
  return this.set(attr, new _ParseOp.AddOp(items));
834
805
  }
835
806
 
@@ -842,7 +813,7 @@ class ParseObject {
842
813
  * @param item {} The object to add.
843
814
  * @returns {(ParseObject | boolean)}
844
815
  */
845
- addUnique(attr /*: string*/, item /*: any*/) /*: ParseObject | boolean*/{
816
+ addUnique(attr, item) {
846
817
  return this.set(attr, new _ParseOp.AddUniqueOp([item]));
847
818
  }
848
819
 
@@ -855,7 +826,7 @@ class ParseObject {
855
826
  * @param items {Object[]} The objects to add.
856
827
  * @returns {(ParseObject | boolean)}
857
828
  */
858
- addAllUnique(attr /*: string*/, items /*: Array<any>*/) /*: ParseObject | boolean*/{
829
+ addAllUnique(attr, items) {
859
830
  return this.set(attr, new _ParseOp.AddUniqueOp(items));
860
831
  }
861
832
 
@@ -867,7 +838,7 @@ class ParseObject {
867
838
  * @param item {} The object to remove.
868
839
  * @returns {(ParseObject | boolean)}
869
840
  */
870
- remove(attr /*: string*/, item /*: any*/) /*: ParseObject | boolean*/{
841
+ remove(attr, item) {
871
842
  return this.set(attr, new _ParseOp.RemoveOp([item]));
872
843
  }
873
844
 
@@ -879,7 +850,7 @@ class ParseObject {
879
850
  * @param items {Object[]} The object to remove.
880
851
  * @returns {(ParseObject | boolean)}
881
852
  */
882
- removeAll(attr /*: string*/, items /*: Array<any>*/) /*: ParseObject | boolean*/{
853
+ removeAll(attr, items) {
883
854
  return this.set(attr, new _ParseOp.RemoveOp(items));
884
855
  }
885
856
 
@@ -892,7 +863,7 @@ class ParseObject {
892
863
  * @param attr {String} The key.
893
864
  * @returns {Parse.Op | undefined} The operation, or undefined if none.
894
865
  */
895
- op(attr /*: string*/) /*: Op | undefined*/{
866
+ op(attr) {
896
867
  const pending = this._getPendingOps();
897
868
  for (let i = pending.length; i--;) {
898
869
  if (pending[i][attr]) {
@@ -906,7 +877,7 @@ class ParseObject {
906
877
  *
907
878
  * @returns {Parse.Object}
908
879
  */
909
- clone() /*: any*/{
880
+ clone() {
910
881
  const clone = new this.constructor(this.className);
911
882
  let attributes = this.attributes;
912
883
  if (typeof this.constructor.readOnlyAttributes === 'function') {
@@ -932,7 +903,7 @@ class ParseObject {
932
903
  *
933
904
  * @returns {Parse.Object}
934
905
  */
935
- newInstance() /*: any*/{
906
+ newInstance() {
936
907
  const clone = new this.constructor(this.className);
937
908
  clone.id = this.id;
938
909
  if (singleInstance) {
@@ -951,7 +922,7 @@ class ParseObject {
951
922
  *
952
923
  * @returns {boolean}
953
924
  */
954
- isNew() /*: boolean*/{
925
+ isNew() {
955
926
  return !this.id;
956
927
  }
957
928
 
@@ -962,7 +933,7 @@ class ParseObject {
962
933
  *
963
934
  * @returns {boolean}
964
935
  */
965
- existed() /*: boolean*/{
936
+ existed() {
966
937
  if (!this.id) {
967
938
  return false;
968
939
  }
@@ -986,7 +957,7 @@ class ParseObject {
986
957
  * </ul>
987
958
  * @returns {Promise<boolean>} A boolean promise that is fulfilled if object exists.
988
959
  */
989
- async exists(options /*:: ?: RequestOptions*/) /*: Promise<boolean>*/{
960
+ async exists(options) {
990
961
  if (!this.id) {
991
962
  return false;
992
963
  }
@@ -1008,7 +979,7 @@ class ParseObject {
1008
979
  *
1009
980
  * @returns {boolean}
1010
981
  */
1011
- isValid() /*: boolean*/{
982
+ isValid() {
1012
983
  return !this.validate(this.attributes);
1013
984
  }
1014
985
 
@@ -1022,7 +993,7 @@ class ParseObject {
1022
993
  * @returns {Parse.Error|boolean} False if the data is valid. An error object otherwise.
1023
994
  * @see Parse.Object#set
1024
995
  */
1025
- validate(attrs /*: AttributeMap*/) /*: ParseError | boolean*/{
996
+ validate(attrs) {
1026
997
  if (attrs.hasOwnProperty('ACL') && !(attrs.ACL instanceof _ParseACL.default)) {
1027
998
  return new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'ACL must be a Parse ACL.');
1028
999
  }
@@ -1040,7 +1011,7 @@ class ParseObject {
1040
1011
  * @returns {Parse.ACL|null} An instance of Parse.ACL.
1041
1012
  * @see Parse.Object#get
1042
1013
  */
1043
- getACL() /*: ParseACL | null*/{
1014
+ getACL() {
1044
1015
  const acl = this.get('ACL');
1045
1016
  if (acl instanceof _ParseACL.default) {
1046
1017
  return acl;
@@ -1056,7 +1027,7 @@ class ParseObject {
1056
1027
  * @returns {(ParseObject | boolean)} Whether the set passed validation.
1057
1028
  * @see Parse.Object#set
1058
1029
  */
1059
- setACL(acl /*: ParseACL*/, options /*:: ?: any*/) /*: ParseObject | boolean*/{
1030
+ setACL(acl, options) {
1060
1031
  return this.set('ACL', acl, options);
1061
1032
  }
1062
1033
 
@@ -1065,7 +1036,7 @@ class ParseObject {
1065
1036
  *
1066
1037
  * @param {string} [keys] - specify which fields to revert
1067
1038
  */
1068
- revert(...keys) /*: void*/{
1039
+ revert(...keys) {
1069
1040
  let keysToRevert;
1070
1041
  if (keys.length) {
1071
1042
  keysToRevert = [];
@@ -1085,7 +1056,7 @@ class ParseObject {
1085
1056
  *
1086
1057
  * @returns {(ParseObject | boolean)}
1087
1058
  */
1088
- clear() /*: ParseObject | boolean*/{
1059
+ clear() {
1089
1060
  const attributes = this.attributes;
1090
1061
  const erasable = {};
1091
1062
  let readonly = ['createdAt', 'updatedAt'];
@@ -1119,9 +1090,9 @@ class ParseObject {
1119
1090
  * @returns {Promise} A promise that is fulfilled when the fetch
1120
1091
  * completes.
1121
1092
  */
1122
- fetch(options /*: FetchOptions*/) /*: Promise<any>*/{
1093
+ fetch(options) {
1123
1094
  options = options || {};
1124
- const fetchOptions /*: FetchOptions*/ = {};
1095
+ const fetchOptions = {};
1125
1096
  if (options.hasOwnProperty('useMasterKey')) {
1126
1097
  fetchOptions.useMasterKey = options.useMasterKey;
1127
1098
  }
@@ -1167,7 +1138,7 @@ class ParseObject {
1167
1138
  * @returns {Promise} A promise that is fulfilled when the fetch
1168
1139
  * completes.
1169
1140
  */
1170
- fetchWithInclude(keys /*: String | Array<string | Array<string>>*/, options /*: RequestOptions*/) /*: Promise<any>*/{
1141
+ fetchWithInclude(keys, options) {
1171
1142
  options = options || {};
1172
1143
  options.include = keys;
1173
1144
  return this.fetch(options);
@@ -1197,7 +1168,7 @@ class ParseObject {
1197
1168
  * @returns {Promise} A promise that is fulfilled when the save
1198
1169
  * completes.
1199
1170
  */
1200
- async saveEventually(options /*: SaveOptions*/) /*: Promise<this>*/{
1171
+ async saveEventually(options) {
1201
1172
  try {
1202
1173
  await this.save(null, options);
1203
1174
  } catch (e) {
@@ -1272,7 +1243,7 @@ class ParseObject {
1272
1243
  * @returns {Promise} A promise that is fulfilled when the save
1273
1244
  * completes.
1274
1245
  */
1275
- save(arg1 /*: undefined | string | { [attr: string]: any } | null*/, arg2 /*: SaveOptions | any*/, arg3 /*:: ?: SaveOptions*/) /*: Promise<this>*/{
1246
+ save(arg1, arg2, arg3) {
1276
1247
  let attrs;
1277
1248
  let options;
1278
1249
  if (typeof arg1 === 'object' || typeof arg1 === 'undefined') {
@@ -1296,7 +1267,7 @@ class ParseObject {
1296
1267
  return Promise.reject(validationError);
1297
1268
  }
1298
1269
  }
1299
- const saveOptions /*: SaveOptions*/ = {};
1270
+ const saveOptions = {};
1300
1271
  if (options.hasOwnProperty('useMasterKey')) {
1301
1272
  saveOptions.useMasterKey = !!options.useMasterKey;
1302
1273
  }
@@ -1338,7 +1309,7 @@ class ParseObject {
1338
1309
  * @returns {Promise} A promise that is fulfilled when the destroy
1339
1310
  * completes.
1340
1311
  */
1341
- async destroyEventually(options /*: RequestOptions*/) /*: Promise<this>*/{
1312
+ async destroyEventually(options) {
1342
1313
  try {
1343
1314
  await this.destroy(options);
1344
1315
  } catch (e) {
@@ -1364,9 +1335,9 @@ class ParseObject {
1364
1335
  * @returns {Promise} A promise that is fulfilled when the destroy
1365
1336
  * completes.
1366
1337
  */
1367
- destroy(options /*: RequestOptions*/) /*: Promise<void | ParseObject>*/{
1338
+ destroy(options) {
1368
1339
  options = options || {};
1369
- const destroyOptions /*: RequestOptions*/ = {};
1340
+ const destroyOptions = {};
1370
1341
  if (options.hasOwnProperty('useMasterKey')) {
1371
1342
  destroyOptions.useMasterKey = options.useMasterKey;
1372
1343
  }
@@ -1398,7 +1369,7 @@ class ParseObject {
1398
1369
  *
1399
1370
  * @returns {Promise} A promise that is fulfilled when the pin completes.
1400
1371
  */
1401
- pin() /*: Promise<void>*/{
1372
+ pin() {
1402
1373
  return ParseObject.pinAllWithName(_LocalDatastoreUtils.DEFAULT_PIN, [this]);
1403
1374
  }
1404
1375
 
@@ -1412,7 +1383,7 @@ class ParseObject {
1412
1383
  *
1413
1384
  * @returns {Promise} A promise that is fulfilled when the unPin completes.
1414
1385
  */
1415
- unPin() /*: Promise<void>*/{
1386
+ unPin() {
1416
1387
  return ParseObject.unPinAllWithName(_LocalDatastoreUtils.DEFAULT_PIN, [this]);
1417
1388
  }
1418
1389
 
@@ -1425,7 +1396,7 @@ class ParseObject {
1425
1396
  *
1426
1397
  * @returns {Promise<boolean>} A boolean promise that is fulfilled if object is pinned.
1427
1398
  */
1428
- async isPinned() /*: Promise<boolean>*/{
1399
+ async isPinned() {
1429
1400
  const localDatastore = _CoreManager.default.getLocalDatastore();
1430
1401
  if (!localDatastore.isEnabled) {
1431
1402
  return Promise.reject('Parse.enableLocalDatastore() must be called first');
@@ -1451,7 +1422,7 @@ class ParseObject {
1451
1422
  * @param {string} name Name of Pin.
1452
1423
  * @returns {Promise} A promise that is fulfilled when the pin completes.
1453
1424
  */
1454
- pinWithName(name /*: string*/) /*: Promise<void>*/{
1425
+ pinWithName(name) {
1455
1426
  return ParseObject.pinAllWithName(name, [this]);
1456
1427
  }
1457
1428
 
@@ -1465,7 +1436,7 @@ class ParseObject {
1465
1436
  * @param {string} name Name of Pin.
1466
1437
  * @returns {Promise} A promise that is fulfilled when the unPin completes.
1467
1438
  */
1468
- unPinWithName(name /*: string*/) /*: Promise<void>*/{
1439
+ unPinWithName(name) {
1469
1440
  return ParseObject.unPinAllWithName(name, [this]);
1470
1441
  }
1471
1442
 
@@ -1481,7 +1452,7 @@ class ParseObject {
1481
1452
  *
1482
1453
  * @returns {Promise} A promise that is fulfilled when the fetch completes.
1483
1454
  */
1484
- async fetchFromLocalDatastore() /*: Promise<ParseObject>*/{
1455
+ async fetchFromLocalDatastore() {
1485
1456
  const localDatastore = _CoreManager.default.getLocalDatastore();
1486
1457
  if (!localDatastore.isEnabled) {
1487
1458
  throw new Error('Parse.enableLocalDatastore() must be called first');
@@ -1529,8 +1500,8 @@ class ParseObject {
1529
1500
  * @static
1530
1501
  * @returns {Parse.Object[]}
1531
1502
  */
1532
- static fetchAll(list /*: Array<ParseObject>*/, options /*: RequestOptions*/ = {}) {
1533
- const queryOptions /*: RequestOptions*/ = {};
1503
+ static fetchAll(list, options = {}) {
1504
+ const queryOptions = {};
1534
1505
  if (options.hasOwnProperty('useMasterKey')) {
1535
1506
  queryOptions.useMasterKey = options.useMasterKey;
1536
1507
  }
@@ -1572,7 +1543,7 @@ class ParseObject {
1572
1543
  * @static
1573
1544
  * @returns {Parse.Object[]}
1574
1545
  */
1575
- static fetchAllWithInclude(list /*: Array<ParseObject>*/, keys /*: String | Array<string | Array<string>>*/, options /*: RequestOptions*/) {
1546
+ static fetchAllWithInclude(list, keys, options) {
1576
1547
  options = options || {};
1577
1548
  options.include = keys;
1578
1549
  return ParseObject.fetchAll(list, options);
@@ -1608,7 +1579,7 @@ class ParseObject {
1608
1579
  * @static
1609
1580
  * @returns {Parse.Object[]}
1610
1581
  */
1611
- static fetchAllIfNeededWithInclude(list /*: Array<ParseObject>*/, keys /*: String | Array<string | Array<string>>*/, options /*: RequestOptions*/) {
1582
+ static fetchAllIfNeededWithInclude(list, keys, options) {
1612
1583
  options = options || {};
1613
1584
  options.include = keys;
1614
1585
  return ParseObject.fetchAllIfNeeded(list, options);
@@ -1632,9 +1603,9 @@ class ParseObject {
1632
1603
  * @static
1633
1604
  * @returns {Parse.Object[]}
1634
1605
  */
1635
- static fetchAllIfNeeded(list /*: Array<ParseObject>*/, options /*: FetchOptions*/) {
1606
+ static fetchAllIfNeeded(list, options) {
1636
1607
  options = options || {};
1637
- const queryOptions /*: FetchOptions*/ = {};
1608
+ const queryOptions = {};
1638
1609
  if (options.hasOwnProperty('useMasterKey')) {
1639
1610
  queryOptions.useMasterKey = options.useMasterKey;
1640
1611
  }
@@ -1646,7 +1617,7 @@ class ParseObject {
1646
1617
  }
1647
1618
  return _CoreManager.default.getObjectController().fetch(list, false, queryOptions);
1648
1619
  }
1649
- static handleIncludeOptions(options /*: { include?: string | string[] }*/) {
1620
+ static handleIncludeOptions(options) {
1650
1621
  let include = [];
1651
1622
  if (Array.isArray(options.include)) {
1652
1623
  options.include.forEach(key => {
@@ -1708,8 +1679,8 @@ class ParseObject {
1708
1679
  * @returns {Promise} A promise that is fulfilled when the destroyAll
1709
1680
  * completes.
1710
1681
  */
1711
- static destroyAll(list /*: Array<ParseObject>*/, options /*: SaveOptions*/ = {}) {
1712
- const destroyOptions /*: SaveOptions*/ = {};
1682
+ static destroyAll(list, options = {}) {
1683
+ const destroyOptions = {};
1713
1684
  if (options.hasOwnProperty('useMasterKey')) {
1714
1685
  destroyOptions.useMasterKey = options.useMasterKey;
1715
1686
  }
@@ -1743,8 +1714,8 @@ class ParseObject {
1743
1714
  * @static
1744
1715
  * @returns {Parse.Object[]}
1745
1716
  */
1746
- static saveAll(list /*: Array<ParseObject>*/, options /*: SaveOptions*/ = {}) {
1747
- const saveOptions /*: SaveOptions*/ = {};
1717
+ static saveAll(list, options = {}) {
1718
+ const saveOptions = {};
1748
1719
  if (options.hasOwnProperty('useMasterKey')) {
1749
1720
  saveOptions.useMasterKey = options.useMasterKey;
1750
1721
  }
@@ -1774,7 +1745,7 @@ class ParseObject {
1774
1745
  * @static
1775
1746
  * @returns {Parse.Object} A Parse.Object reference.
1776
1747
  */
1777
- static createWithoutData(id /*: string*/) /*: ParseObject*/{
1748
+ static createWithoutData(id) {
1778
1749
  const obj = new this();
1779
1750
  obj.id = id;
1780
1751
  return obj;
@@ -1790,13 +1761,13 @@ class ParseObject {
1790
1761
  * @static
1791
1762
  * @returns {Parse.Object} A Parse.Object reference
1792
1763
  */
1793
- static fromJSON(json /*: any*/, override /*:: ?: boolean*/, dirty /*:: ?: boolean*/) /*: ParseObject*/{
1764
+ static fromJSON(json, override, dirty) {
1794
1765
  if (!json.className) {
1795
1766
  throw new Error('Cannot create an object without a className');
1796
1767
  }
1797
1768
  const constructor = classMap[json.className];
1798
1769
  const o = constructor ? new constructor(json.className) : new ParseObject(json.className);
1799
- const otherAttributes /*: AttributeMap*/ = {};
1770
+ const otherAttributes = {};
1800
1771
  for (const attr in json) {
1801
1772
  if (attr !== 'className' && attr !== '__type') {
1802
1773
  otherAttributes[attr] = json[attr];
@@ -1835,7 +1806,7 @@ class ParseObject {
1835
1806
  * @param {string} className The class name of the subclass
1836
1807
  * @param {Function} constructor The subclass
1837
1808
  */
1838
- static registerSubclass(className /*: string*/, constructor /*: any*/) {
1809
+ static registerSubclass(className, constructor) {
1839
1810
  if (typeof className !== 'string') {
1840
1811
  throw new TypeError('The first argument must be a valid class name.');
1841
1812
  }
@@ -1856,7 +1827,7 @@ class ParseObject {
1856
1827
  *
1857
1828
  * @param {string} className The class name of the subclass
1858
1829
  */
1859
- static unregisterSubclass(className /*: string*/) {
1830
+ static unregisterSubclass(className) {
1860
1831
  if (typeof className !== 'string') {
1861
1832
  throw new TypeError('The first argument must be a valid class name.');
1862
1833
  }
@@ -1894,13 +1865,13 @@ class ParseObject {
1894
1865
  * });</pre></p>
1895
1866
  *
1896
1867
  * @param {string} className The name of the Parse class backing this model.
1897
- * @param {object} protoProps Instance properties to add to instances of the
1868
+ * @param {object} [protoProps] Instance properties to add to instances of the
1898
1869
  * class returned from this method.
1899
- * @param {object} classProps Class properties to add the class returned from
1870
+ * @param {object} [classProps] Class properties to add the class returned from
1900
1871
  * this method.
1901
1872
  * @returns {Parse.Object} A new subclass of Parse.Object.
1902
1873
  */
1903
- static extend(className /*: any*/, protoProps /*: any*/, classProps /*: any*/) {
1874
+ static extend(className, protoProps, classProps) {
1904
1875
  if (typeof className !== 'string') {
1905
1876
  if (className && typeof className.className === 'string') {
1906
1877
  return ParseObject.extend(className.className, className, protoProps);
@@ -2036,7 +2007,7 @@ class ParseObject {
2036
2007
  * @returns {Promise} A promise that is fulfilled when the pin completes.
2037
2008
  * @static
2038
2009
  */
2039
- static pinAll(objects /*: Array<ParseObject>*/) /*: Promise<void>*/{
2010
+ static pinAll(objects) {
2040
2011
  const localDatastore = _CoreManager.default.getLocalDatastore();
2041
2012
  if (!localDatastore.isEnabled) {
2042
2013
  return Promise.reject('Parse.enableLocalDatastore() must be called first');
@@ -2062,7 +2033,7 @@ class ParseObject {
2062
2033
  * @returns {Promise} A promise that is fulfilled when the pin completes.
2063
2034
  * @static
2064
2035
  */
2065
- static pinAllWithName(name /*: string*/, objects /*: Array<ParseObject>*/) /*: Promise<void>*/{
2036
+ static pinAllWithName(name, objects) {
2066
2037
  const localDatastore = _CoreManager.default.getLocalDatastore();
2067
2038
  if (!localDatastore.isEnabled) {
2068
2039
  return Promise.reject('Parse.enableLocalDatastore() must be called first');
@@ -2082,7 +2053,7 @@ class ParseObject {
2082
2053
  * @returns {Promise} A promise that is fulfilled when the unPin completes.
2083
2054
  * @static
2084
2055
  */
2085
- static unPinAll(objects /*: Array<ParseObject>*/) /*: Promise<void>*/{
2056
+ static unPinAll(objects) {
2086
2057
  const localDatastore = _CoreManager.default.getLocalDatastore();
2087
2058
  if (!localDatastore.isEnabled) {
2088
2059
  return Promise.reject('Parse.enableLocalDatastore() must be called first');
@@ -2102,7 +2073,7 @@ class ParseObject {
2102
2073
  * @returns {Promise} A promise that is fulfilled when the unPin completes.
2103
2074
  * @static
2104
2075
  */
2105
- static unPinAllWithName(name /*: string*/, objects /*: Array<ParseObject>*/) /*: Promise<void>*/{
2076
+ static unPinAllWithName(name, objects) {
2106
2077
  const localDatastore = _CoreManager.default.getLocalDatastore();
2107
2078
  if (!localDatastore.isEnabled) {
2108
2079
  return Promise.reject('Parse.enableLocalDatastore() must be called first');
@@ -2120,7 +2091,7 @@ class ParseObject {
2120
2091
  * @returns {Promise} A promise that is fulfilled when the unPin completes.
2121
2092
  * @static
2122
2093
  */
2123
- static unPinAllObjects() /*: Promise<void>*/{
2094
+ static unPinAllObjects() {
2124
2095
  const localDatastore = _CoreManager.default.getLocalDatastore();
2125
2096
  if (!localDatastore.isEnabled) {
2126
2097
  return Promise.reject('Parse.enableLocalDatastore() must be called first');
@@ -2140,7 +2111,7 @@ class ParseObject {
2140
2111
  * @returns {Promise} A promise that is fulfilled when the unPin completes.
2141
2112
  * @static
2142
2113
  */
2143
- static unPinAllObjectsWithName(name /*: string*/) /*: Promise<void>*/{
2114
+ static unPinAllObjectsWithName(name) {
2144
2115
  const localDatastore = _CoreManager.default.getLocalDatastore();
2145
2116
  if (!localDatastore.isEnabled) {
2146
2117
  return Promise.reject('Parse.enableLocalDatastore() must be called first');
@@ -2149,7 +2120,7 @@ class ParseObject {
2149
2120
  }
2150
2121
  }
2151
2122
  const DefaultController = {
2152
- fetch(target /*: ParseObject | Array<ParseObject>*/, forceFetch /*: boolean*/, options /*: RequestOptions*/) /*: Promise<Array<ParseObject | undefined> | ParseObject | undefined>*/{
2123
+ fetch(target, forceFetch, options) {
2153
2124
  const localDatastore = _CoreManager.default.getLocalDatastore();
2154
2125
  if (Array.isArray(target)) {
2155
2126
  if (target.length < 1) {
@@ -2223,7 +2194,7 @@ const DefaultController = {
2223
2194
  return Promise.reject(new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'Object does not have an ID'));
2224
2195
  }
2225
2196
  const RESTController = _CoreManager.default.getRESTController();
2226
- const params /*: RequestOptions*/ = {};
2197
+ const params = {};
2227
2198
  if (options && options.include) {
2228
2199
  params.include = options.include.join();
2229
2200
  }
@@ -2237,7 +2208,7 @@ const DefaultController = {
2237
2208
  }
2238
2209
  return Promise.resolve(undefined);
2239
2210
  },
2240
- async destroy(target /*: ParseObject | Array<ParseObject>*/, options /*: RequestOptions*/) /*: Promise<ParseObject | Array<ParseObject>>*/{
2211
+ async destroy(target, options) {
2241
2212
  const batchSize = options && options.batchSize ? options.batchSize : _CoreManager.default.get('REQUEST_BATCH_SIZE');
2242
2213
  const localDatastore = _CoreManager.default.getLocalDatastore();
2243
2214
  const RESTController = _CoreManager.default.getRESTController();
@@ -2301,7 +2272,7 @@ const DefaultController = {
2301
2272
  }
2302
2273
  return Promise.resolve(target);
2303
2274
  },
2304
- save(target /*: ParseObject | null | Array<ParseObject | ParseFile>*/, options /*: RequestOptions*/) /*: Promise<ParseObject | Array<ParseObject> | ParseFile>*/{
2275
+ save(target, options) {
2305
2276
  const batchSize = options && options.batchSize ? options.batchSize : _CoreManager.default.get('REQUEST_BATCH_SIZE');
2306
2277
  const localDatastore = _CoreManager.default.getLocalDatastore();
2307
2278
  const mapIdForPin = {};
@@ -2316,13 +2287,14 @@ const DefaultController = {
2316
2287
  }
2317
2288
  let unsaved = target.concat();
2318
2289
  for (let i = 0; i < target.length; i++) {
2319
- if (target[i] instanceof ParseObject) {
2320
- unsaved = unsaved.concat((0, _unsavedChildren.default)(target[i], true));
2290
+ const target_i = target[i];
2291
+ if (target_i instanceof ParseObject) {
2292
+ unsaved = unsaved.concat((0, _unsavedChildren.default)(target_i, true));
2321
2293
  }
2322
2294
  }
2323
2295
  unsaved = (0, _unique.default)(unsaved);
2324
- const filesSaved /*: Array<ParseFile>*/ = [];
2325
- let pending /*: Array<ParseObject>*/ = [];
2296
+ const filesSaved = [];
2297
+ let pending = [];
2326
2298
  unsaved.forEach(el => {
2327
2299
  if (el instanceof _ParseFile.default) {
2328
2300
  filesSaved.push(el.save(options));
@@ -2355,8 +2327,8 @@ const DefaultController = {
2355
2327
  // Queue up tasks for each object in the batch.
2356
2328
  // When every task is ready, the API request will execute
2357
2329
  const batchReturned = (0, _promiseUtils.resolvingPromise)();
2358
- const batchReady /*: ReturnType<typeof resolvingPromise<void>>[]*/ = [];
2359
- const batchTasks /*: Promise<void>[]*/ = [];
2330
+ const batchReady = [];
2331
+ const batchTasks = [];
2360
2332
  batch.forEach((obj, index) => {
2361
2333
  const ready = (0, _promiseUtils.resolvingPromise)();
2362
2334
  batchReady.push(ready);
@@ -2418,7 +2390,7 @@ const DefaultController = {
2418
2390
  // generate _localId in case if cascadeSave=false
2419
2391
  target._getId();
2420
2392
  const localId = target._localId;
2421
- // copying target lets Flow guarantee the pointer isn't modified elsewhere
2393
+ // copying target lets guarantee the pointer isn't modified elsewhere
2422
2394
  const targetCopy = target;
2423
2395
  const task = function () {
2424
2396
  const params = targetCopy._getSaveParams();
@@ -2442,10 +2414,9 @@ const DefaultController = {
2442
2414
  return Promise.reject(error);
2443
2415
  });
2444
2416
  }
2445
- return Promise.resolve();
2417
+ return Promise.resolve(undefined);
2446
2418
  }
2447
2419
  };
2448
2420
  _CoreManager.default.setParseObject(ParseObject);
2449
2421
  _CoreManager.default.setObjectController(DefaultController);
2450
- var _default = ParseObject;
2451
- exports.default = _default;
2422
+ var _default = exports.default = ParseObject;