parse 5.2.0-alpha.1 → 5.2.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/dist/parse.js +10519 -15246
  2. package/dist/parse.min.js +2 -2
  3. package/dist/parse.weapp.js +10499 -15371
  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 +23 -41
  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 -485
  16. package/lib/browser/LiveQuerySubscription.js +25 -28
  17. package/lib/browser/LocalDatastore.js +258 -624
  18. package/lib/browser/LocalDatastoreController.default.js +42 -226
  19. package/lib/browser/LocalDatastoreController.js +11 -1
  20. package/lib/browser/LocalDatastoreController.react-native.js +66 -160
  21. package/lib/browser/LocalDatastoreUtils.js +4 -7
  22. package/lib/browser/ObjectStateMutations.js +54 -96
  23. package/lib/browser/OfflineQuery.js +106 -198
  24. package/lib/browser/Parse.js +44 -60
  25. package/lib/browser/ParseACL.js +242 -288
  26. package/lib/browser/ParseCLP.js +372 -572
  27. package/lib/browser/ParseConfig.js +115 -138
  28. package/lib/browser/ParseError.js +85 -182
  29. package/lib/browser/ParseFile.js +294 -438
  30. package/lib/browser/ParseGeoPoint.js +121 -146
  31. package/lib/browser/ParseHooks.js +23 -25
  32. package/lib/browser/ParseInstallation.js +225 -367
  33. package/lib/browser/ParseLiveQuery.js +74 -148
  34. package/lib/browser/ParseObject.js +2014 -2621
  35. package/lib/browser/ParseOp.js +343 -484
  36. package/lib/browser/ParsePolygon.js +101 -120
  37. package/lib/browser/ParseQuery.js +1708 -2052
  38. package/lib/browser/ParseRelation.js +99 -118
  39. package/lib/browser/ParseRole.js +88 -140
  40. package/lib/browser/ParseSchema.js +372 -434
  41. package/lib/browser/ParseSession.js +62 -110
  42. package/lib/browser/ParseUser.js +941 -1284
  43. package/lib/browser/Push.js +15 -38
  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 +31 -43
  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 +5 -9
  70. package/lib/node/AnonymousUtils.js +10 -15
  71. package/lib/node/Cloud.js +11 -11
  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 +20 -39
  76. package/lib/node/FacebookUtils.js +4 -8
  77. package/lib/node/IndexedDBStorageController.js +14 -10
  78. package/lib/node/InstallationController.js +12 -13
  79. package/lib/node/LiveQueryClient.js +23 -21
  80. package/lib/node/LiveQuerySubscription.js +6 -7
  81. package/lib/node/LocalDatastore.js +23 -23
  82. package/lib/node/LocalDatastoreController.default.js +11 -12
  83. package/lib/node/LocalDatastoreController.js +14 -1
  84. package/lib/node/LocalDatastoreController.react-native.js +25 -21
  85. package/lib/node/LocalDatastoreUtils.js +4 -7
  86. package/lib/node/ObjectStateMutations.js +12 -22
  87. package/lib/node/OfflineQuery.js +37 -23
  88. package/lib/node/Parse.js +36 -50
  89. package/lib/node/ParseACL.js +21 -30
  90. package/lib/node/ParseCLP.js +38 -40
  91. package/lib/node/ParseConfig.js +10 -17
  92. package/lib/node/ParseError.js +460 -461
  93. package/lib/node/ParseFile.js +27 -47
  94. package/lib/node/ParseGeoPoint.js +16 -17
  95. package/lib/node/ParseHooks.js +16 -18
  96. package/lib/node/ParseInstallation.js +10 -11
  97. package/lib/node/ParseLiveQuery.js +9 -14
  98. package/lib/node/ParseObject.js +142 -173
  99. package/lib/node/ParseOp.js +35 -47
  100. package/lib/node/ParsePolygon.js +14 -20
  101. package/lib/node/ParseQuery.js +100 -123
  102. package/lib/node/ParseRelation.js +10 -19
  103. package/lib/node/ParseRole.js +10 -11
  104. package/lib/node/ParseSchema.js +29 -42
  105. package/lib/node/ParseSession.js +10 -11
  106. package/lib/node/ParseUser.js +76 -87
  107. package/lib/node/Push.js +7 -12
  108. package/lib/node/RESTController.js +24 -36
  109. package/lib/node/SingleInstanceStateController.js +41 -69
  110. package/lib/node/Socket.weapp.js +23 -2
  111. package/lib/node/Storage.js +14 -19
  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 +20 -20
  116. package/lib/node/StorageController.weapp.js +14 -8
  117. package/lib/node/TaskQueue.js +2 -3
  118. package/lib/node/UniqueInstanceStateController.js +43 -63
  119. package/lib/node/WebSocketController.js +15 -2
  120. package/lib/node/Xhr.weapp.js +11 -2
  121. package/lib/node/arrayContainsObject.js +4 -4
  122. package/lib/node/canBeSerialized.js +5 -5
  123. package/lib/node/decode.js +4 -4
  124. package/lib/node/encode.js +5 -5
  125. package/lib/node/equals.js +4 -4
  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 +5 -5
  131. package/lib/node/unsavedChildren.js +5 -5
  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/CoreManager.js +2 -3
  136. package/lib/react-native/CryptoController.js +6 -1
  137. package/lib/react-native/EventEmitter.js +6 -1
  138. package/lib/react-native/EventuallyQueue.js +1 -2
  139. package/lib/react-native/FacebookUtils.js +1 -2
  140. package/lib/react-native/IndexedDBStorageController.js +11 -5
  141. package/lib/react-native/InstallationController.js +1 -2
  142. package/lib/react-native/LiveQueryClient.js +8 -7
  143. package/lib/react-native/LiveQuerySubscription.js +2 -4
  144. package/lib/react-native/LocalDatastore.js +3 -3
  145. package/lib/react-native/LocalDatastoreController.default.js +1 -2
  146. package/lib/react-native/LocalDatastoreController.js +11 -1
  147. package/lib/react-native/LocalDatastoreController.react-native.js +11 -12
  148. package/lib/react-native/LocalDatastoreUtils.js +3 -6
  149. package/lib/react-native/OfflineQuery.js +25 -20
  150. package/lib/react-native/Parse.js +24 -38
  151. package/lib/react-native/ParseACL.js +4 -6
  152. package/lib/react-native/ParseCLP.js +2 -4
  153. package/lib/react-native/ParseConfig.js +4 -6
  154. package/lib/react-native/ParseError.js +13 -31
  155. package/lib/react-native/ParseFile.js +3 -4
  156. package/lib/react-native/ParseGeoPoint.js +2 -4
  157. package/lib/react-native/ParseInstallation.js +13 -30
  158. package/lib/react-native/ParseLiveQuery.js +2 -4
  159. package/lib/react-native/ParseObject.js +77 -87
  160. package/lib/react-native/ParseOp.js +41 -79
  161. package/lib/react-native/ParsePolygon.js +2 -4
  162. package/lib/react-native/ParseQuery.js +43 -45
  163. package/lib/react-native/ParseRelation.js +2 -4
  164. package/lib/react-native/ParseRole.js +13 -30
  165. package/lib/react-native/ParseSchema.js +3 -5
  166. package/lib/react-native/ParseSession.js +12 -29
  167. package/lib/react-native/ParseUser.js +24 -49
  168. package/lib/react-native/RESTController.js +10 -4
  169. package/lib/react-native/SingleInstanceStateController.js +23 -37
  170. package/lib/react-native/Socket.weapp.js +9 -4
  171. package/lib/react-native/Storage.js +1 -2
  172. package/lib/react-native/StorageController.browser.js +6 -1
  173. package/lib/react-native/StorageController.default.js +6 -1
  174. package/lib/react-native/StorageController.js +13 -1
  175. package/lib/react-native/StorageController.react-native.js +11 -6
  176. package/lib/react-native/StorageController.weapp.js +6 -1
  177. package/lib/react-native/TaskQueue.js +2 -4
  178. package/lib/react-native/UniqueInstanceStateController.js +23 -37
  179. package/lib/react-native/WebSocketController.js +9 -1
  180. package/lib/react-native/Xhr.weapp.js +9 -4
  181. package/lib/react-native/unsavedChildren.js +3 -3
  182. package/lib/react-native/uuid.js +1 -2
  183. package/lib/weapp/Analytics.js +7 -11
  184. package/lib/weapp/AnonymousUtils.js +17 -22
  185. package/lib/weapp/Cloud.js +23 -41
  186. package/lib/weapp/CoreManager.js +71 -79
  187. package/lib/weapp/CryptoController.js +14 -9
  188. package/lib/weapp/EventEmitter.js +9 -2
  189. package/lib/weapp/EventuallyQueue.js +156 -357
  190. package/lib/weapp/FacebookUtils.js +23 -28
  191. package/lib/weapp/IndexedDBStorageController.js +18 -14
  192. package/lib/weapp/InstallationController.js +55 -121
  193. package/lib/weapp/LiveQueryClient.js +312 -485
  194. package/lib/weapp/LiveQuerySubscription.js +25 -28
  195. package/lib/weapp/LocalDatastore.js +258 -624
  196. package/lib/weapp/LocalDatastoreController.default.js +42 -226
  197. package/lib/weapp/LocalDatastoreController.js +11 -1
  198. package/lib/weapp/LocalDatastoreController.react-native.js +66 -160
  199. package/lib/weapp/LocalDatastoreUtils.js +4 -7
  200. package/lib/weapp/ObjectStateMutations.js +54 -96
  201. package/lib/weapp/OfflineQuery.js +106 -198
  202. package/lib/weapp/Parse.js +44 -59
  203. package/lib/weapp/ParseACL.js +242 -288
  204. package/lib/weapp/ParseCLP.js +372 -572
  205. package/lib/weapp/ParseConfig.js +115 -138
  206. package/lib/weapp/ParseError.js +85 -182
  207. package/lib/weapp/ParseFile.js +295 -440
  208. package/lib/weapp/ParseGeoPoint.js +121 -146
  209. package/lib/weapp/ParseHooks.js +23 -25
  210. package/lib/weapp/ParseInstallation.js +225 -367
  211. package/lib/weapp/ParseLiveQuery.js +74 -148
  212. package/lib/weapp/ParseObject.js +2014 -2621
  213. package/lib/weapp/ParseOp.js +343 -484
  214. package/lib/weapp/ParsePolygon.js +101 -120
  215. package/lib/weapp/ParseQuery.js +1708 -2052
  216. package/lib/weapp/ParseRelation.js +99 -118
  217. package/lib/weapp/ParseRole.js +88 -140
  218. package/lib/weapp/ParseSchema.js +372 -434
  219. package/lib/weapp/ParseSession.js +62 -110
  220. package/lib/weapp/ParseUser.js +941 -1284
  221. package/lib/weapp/Push.js +15 -38
  222. package/lib/weapp/RESTController.js +86 -125
  223. package/lib/weapp/SingleInstanceStateController.js +57 -86
  224. package/lib/weapp/Socket.weapp.js +50 -33
  225. package/lib/weapp/Storage.js +23 -28
  226. package/lib/weapp/StorageController.browser.js +16 -13
  227. package/lib/weapp/StorageController.default.js +15 -14
  228. package/lib/weapp/StorageController.js +14 -1
  229. package/lib/weapp/StorageController.react-native.js +31 -30
  230. package/lib/weapp/StorageController.weapp.js +19 -13
  231. package/lib/weapp/TaskQueue.js +31 -43
  232. package/lib/weapp/UniqueInstanceStateController.js +65 -86
  233. package/lib/weapp/WebSocketController.js +11 -4
  234. package/lib/weapp/Xhr.weapp.js +90 -78
  235. package/lib/weapp/arrayContainsObject.js +3 -3
  236. package/lib/weapp/canBeSerialized.js +10 -11
  237. package/lib/weapp/decode.js +11 -11
  238. package/lib/weapp/encode.js +11 -11
  239. package/lib/weapp/equals.js +9 -10
  240. package/lib/weapp/escape.js +2 -2
  241. package/lib/weapp/isRevocableSession.js +1 -1
  242. package/lib/weapp/parseDate.js +10 -10
  243. package/lib/weapp/promiseUtils.js +19 -19
  244. package/lib/weapp/unique.js +4 -4
  245. package/lib/weapp/unsavedChildren.js +20 -21
  246. package/lib/weapp/uuid.js +6 -8
  247. package/package.json +24 -30
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
8
8
  var _ParseError = _interopRequireDefault(require("./ParseError"));
9
- function _interopRequireDefault(obj) {
10
- return obj && obj.__esModule ? obj : {
11
- default: obj
9
+ var _Xhr = _interopRequireDefault(require("./Xhr.weapp"));
10
+ function _interopRequireDefault(e) {
11
+ return e && e.__esModule ? e : {
12
+ default: e
12
13
  };
13
14
  }
14
15
  /* global XMLHttpRequest, Blob */
@@ -17,27 +18,7 @@ let XHR = null;
17
18
  if (typeof XMLHttpRequest !== 'undefined') {
18
19
  XHR = XMLHttpRequest;
19
20
  }
20
- /*:: export type FileSaveOptions = FullOptions & {
21
- metadata?: { [key: string]: any },
22
- tags?: { [key: string]: any },
23
- };*/
24
- /*:: export type FileSource =
25
- | {
26
- format: 'file',
27
- file: Blob,
28
- type: string | undefined,
29
- }
30
- | {
31
- format: 'base64',
32
- base64: string,
33
- type: string | undefined,
34
- }
35
- | {
36
- format: 'uri',
37
- uri: string,
38
- type: string | undefined,
39
- };*/
40
- function b64Digit(number /*: number*/) /*: string*/{
21
+ function b64Digit(number) {
41
22
  if (number < 26) {
42
23
  return String.fromCharCode(65 + number);
43
24
  }
@@ -93,7 +74,7 @@ class ParseFile {
93
74
  * @param metadata {object} Optional key value pairs to be stored with file object
94
75
  * @param tags {object} Optional key value pairs to be stored with file object
95
76
  */
96
- constructor(name /*: string*/, data /*:: ?: FileData*/, type /*:: ?: string*/, metadata /*:: ?: object*/, tags /*:: ?: object*/) {
77
+ constructor(name, data, type, metadata, tags) {
97
78
  const specifiedType = type || '';
98
79
  this._name = name;
99
80
  this._metadata = metadata || {};
@@ -140,7 +121,7 @@ class ParseFile {
140
121
  *
141
122
  * @returns {Promise} Promise that is resolve with base64 data
142
123
  */
143
- async getData() /*: Promise<string>*/{
124
+ async getData() {
144
125
  if (this._data) {
145
126
  return this._data;
146
127
  }
@@ -162,7 +143,7 @@ class ParseFile {
162
143
  *
163
144
  * @returns {string}
164
145
  */
165
- name() /*: string*/{
146
+ name() {
166
147
  return this._name;
167
148
  }
168
149
 
@@ -174,7 +155,7 @@ class ParseFile {
174
155
  * @param {boolean} [options.forceSecure] force the url to be secure
175
156
  * @returns {string | undefined}
176
157
  */
177
- url(options /*:: ?: { forceSecure?: boolean }*/) /*: string | undefined*/{
158
+ url(options) {
178
159
  options = options || {};
179
160
  if (!this._url) {
180
161
  return;
@@ -227,7 +208,7 @@ class ParseFile {
227
208
  * </ul>
228
209
  * @returns {Promise | undefined} Promise that is resolved when the save finishes.
229
210
  */
230
- save(options /*:: ?: FileSaveOptions*/) /*: Promise<ParseFile> | undefined*/{
211
+ save(options) {
231
212
  options = options || {};
232
213
  options.requestTask = task => this._requestTask = task;
233
214
  options.metadata = this._metadata;
@@ -255,7 +236,7 @@ class ParseFile {
255
236
  this._data = result.base64;
256
237
  this._requestTask = null;
257
238
  return controller.saveBase64(this._name, newSource, options);
258
- }).then((res /*: { name?: string, url?: string }*/) => {
239
+ }).then(res => {
259
240
  this._name = res.name;
260
241
  this._url = res.url;
261
242
  this._requestTask = null;
@@ -297,7 +278,7 @@ class ParseFile {
297
278
  * <pre>
298
279
  * @returns {Promise} Promise that is resolved when the delete finishes.
299
280
  */
300
- destroy(options /*: FullOptions*/ = {}) {
281
+ destroy(options = {}) {
301
282
  if (!this._name) {
302
283
  throw new _ParseError.default(_ParseError.default.FILE_DELETE_UNNAMED_ERROR, 'Cannot delete an unnamed file.');
303
284
  }
@@ -314,14 +295,14 @@ class ParseFile {
314
295
  return this;
315
296
  });
316
297
  }
317
- toJSON() /*: { __type: 'File', name?: string, url?: string }*/{
298
+ toJSON() {
318
299
  return {
319
300
  __type: 'File',
320
301
  name: this._name,
321
302
  url: this._url
322
303
  };
323
304
  }
324
- equals(other /*: any*/) /*: boolean*/{
305
+ equals(other) {
325
306
  if (this === other) {
326
307
  return true;
327
308
  }
@@ -334,7 +315,7 @@ class ParseFile {
334
315
  *
335
316
  * @param {object} metadata Key value pairs to be stored with file object
336
317
  */
337
- setMetadata(metadata /*: any*/) {
318
+ setMetadata(metadata) {
338
319
  if (metadata && typeof metadata === 'object') {
339
320
  Object.keys(metadata).forEach(key => {
340
321
  this.addMetadata(key, metadata[key]);
@@ -348,7 +329,7 @@ class ParseFile {
348
329
  * @param {string} key key to store the metadata
349
330
  * @param {*} value metadata
350
331
  */
351
- addMetadata(key /*: string*/, value /*: any*/) {
332
+ addMetadata(key, value) {
352
333
  if (typeof key === 'string') {
353
334
  this._metadata[key] = value;
354
335
  }
@@ -359,7 +340,7 @@ class ParseFile {
359
340
  *
360
341
  * @param {object} tags Key value pairs to be stored with file object
361
342
  */
362
- setTags(tags /*: any*/) {
343
+ setTags(tags) {
363
344
  if (tags && typeof tags === 'object') {
364
345
  Object.keys(tags).forEach(key => {
365
346
  this.addTag(key, tags[key]);
@@ -373,12 +354,12 @@ class ParseFile {
373
354
  * @param {string} key key to store tags
374
355
  * @param {*} value tag
375
356
  */
376
- addTag(key /*: string*/, value /*: string*/) {
357
+ addTag(key, value) {
377
358
  if (typeof key === 'string') {
378
359
  this._tags[key] = value;
379
360
  }
380
361
  }
381
- static fromJSON(obj) /*: ParseFile*/{
362
+ static fromJSON(obj) {
382
363
  if (obj.__type !== 'File') {
383
364
  throw new TypeError('JSON object does not represent a ParseFile');
384
365
  }
@@ -386,7 +367,7 @@ class ParseFile {
386
367
  file._url = obj.url;
387
368
  return file;
388
369
  }
389
- static encodeBase64(bytes /*: Array<number> | Uint8Array*/) /*: string*/{
370
+ static encodeBase64(bytes) {
390
371
  const chunks = [];
391
372
  chunks.length = Math.ceil(bytes.length / 3);
392
373
  for (let i = 0; i < chunks.length; i++) {
@@ -401,7 +382,7 @@ class ParseFile {
401
382
  }
402
383
  }
403
384
  const DefaultController = {
404
- saveFile: async function (name /*: string*/, source /*: FileSource*/, options /*:: ?: FileSaveOptions*/) {
385
+ saveFile: async function (name, source, options) {
405
386
  if (source.format !== 'file') {
406
387
  throw new Error('saveFile can only be used with File-type sources.');
407
388
  }
@@ -425,11 +406,11 @@ const DefaultController = {
425
406
  };
426
407
  return await DefaultController.saveBase64(name, newSource, options);
427
408
  },
428
- saveBase64: function (name /*: string*/, source /*: FileSource*/, options /*: FileSaveOptions*/ = {}) {
409
+ saveBase64: function (name, source, options = {}) {
429
410
  if (source.format !== 'base64') {
430
411
  throw new Error('saveBase64 can only be used with Base64-type sources.');
431
412
  }
432
- const data /*: { base64: any, _ContentType?: any, fileData: any }*/ = {
413
+ const data = {
433
414
  base64: source.base64,
434
415
  fileData: {
435
416
  metadata: {
@@ -472,7 +453,7 @@ const DefaultController = {
472
453
  });
473
454
  }
474
455
  },
475
- downloadAjax: function (uri /*: string*/, options /*: any*/) {
456
+ downloadAjax: function (uri, options) {
476
457
  return new Promise((resolve, reject) => {
477
458
  const xhr = new XHR();
478
459
  xhr.open('GET', uri, true);
@@ -497,7 +478,7 @@ const DefaultController = {
497
478
  xhr.send();
498
479
  });
499
480
  },
500
- deleteFile: function (name /*: string*/, options /*:: ?: FullOptions*/) {
481
+ deleteFile: function (name, options) {
501
482
  const headers = {
502
483
  'X-Parse-Application-ID': _CoreManager.default.get('APPLICATION_ID')
503
484
  };
@@ -518,7 +499,7 @@ const DefaultController = {
518
499
  }
519
500
  });
520
501
  },
521
- _setXHR(xhr /*: any*/) {
502
+ _setXHR(xhr) {
522
503
  XHR = xhr;
523
504
  },
524
505
  _getXHR() {
@@ -526,6 +507,5 @@ const DefaultController = {
526
507
  }
527
508
  };
528
509
  _CoreManager.default.setFileController(DefaultController);
529
- var _default = ParseFile;
530
- exports.default = _default;
510
+ var _default = exports.default = ParseFile;
531
511
  exports.b64Digit = b64Digit;
@@ -33,7 +33,7 @@ class ParseGeoPoint {
33
33
  * @param {(number[] | object | number)} arg1 Either a list of coordinate pairs, an object with `latitude`, `longitude`, or the latitude or the point.
34
34
  * @param {number} arg2 The longitude of the GeoPoint
35
35
  */
36
- constructor(arg1 /*: Array<number> | { latitude: number, longitude: number } | number*/, arg2 /*:: ?: number*/) {
36
+ constructor(arg1, arg2) {
37
37
  if (Array.isArray(arg1)) {
38
38
  ParseGeoPoint._validate(arg1[0], arg1[1]);
39
39
  this._latitude = arg1[0];
@@ -59,10 +59,10 @@ class ParseGeoPoint {
59
59
  * @property {number} latitude
60
60
  * @returns {number}
61
61
  */
62
- get latitude() /*: number*/{
62
+ get latitude() {
63
63
  return this._latitude;
64
64
  }
65
- set latitude(val /*: number*/) {
65
+ set latitude(val) {
66
66
  ParseGeoPoint._validate(val, this.longitude);
67
67
  this._latitude = val;
68
68
  }
@@ -74,10 +74,10 @@ class ParseGeoPoint {
74
74
  * @property {number} longitude
75
75
  * @returns {number}
76
76
  */
77
- get longitude() /*: number*/{
77
+ get longitude() {
78
78
  return this._longitude;
79
79
  }
80
- set longitude(val /*: number*/) {
80
+ set longitude(val) {
81
81
  ParseGeoPoint._validate(this.latitude, val);
82
82
  this._longitude = val;
83
83
  }
@@ -87,7 +87,7 @@ class ParseGeoPoint {
87
87
  *
88
88
  * @returns {object}
89
89
  */
90
- toJSON() /*: { __type: string, latitude: number, longitude: number }*/{
90
+ toJSON() {
91
91
  ParseGeoPoint._validate(this._latitude, this._longitude);
92
92
  return {
93
93
  __type: 'GeoPoint',
@@ -95,7 +95,7 @@ class ParseGeoPoint {
95
95
  longitude: this._longitude
96
96
  };
97
97
  }
98
- equals(other /*: any*/) /*: boolean*/{
98
+ equals(other) {
99
99
  return other instanceof ParseGeoPoint && this.latitude === other.latitude && this.longitude === other.longitude;
100
100
  }
101
101
 
@@ -105,7 +105,7 @@ class ParseGeoPoint {
105
105
  * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
106
106
  * @returns {number}
107
107
  */
108
- radiansTo(point /*: ParseGeoPoint*/) /*: number*/{
108
+ radiansTo(point) {
109
109
  const d2r = Math.PI / 180.0;
110
110
  const lat1rad = this.latitude * d2r;
111
111
  const long1rad = this.longitude * d2r;
@@ -125,7 +125,7 @@ class ParseGeoPoint {
125
125
  * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
126
126
  * @returns {number}
127
127
  */
128
- kilometersTo(point /*: ParseGeoPoint*/) /*: number*/{
128
+ kilometersTo(point) {
129
129
  return this.radiansTo(point) * 6371.0;
130
130
  }
131
131
 
@@ -135,14 +135,14 @@ class ParseGeoPoint {
135
135
  * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
136
136
  * @returns {number}
137
137
  */
138
- milesTo(point /*: ParseGeoPoint*/) /*: number*/{
138
+ milesTo(point) {
139
139
  return this.radiansTo(point) * 3958.8;
140
140
  }
141
141
 
142
142
  /*
143
143
  * Throws an exception if the given lat-long is out of bounds.
144
144
  */
145
- static _validate(latitude /*: number*/, longitude /*: number*/) {
145
+ static _validate(latitude, longitude) {
146
146
  if (isNaN(latitude) || isNaN(longitude) || typeof latitude !== 'number' || typeof longitude !== 'number') {
147
147
  throw new TypeError('GeoPoint latitude and longitude must be valid numbers');
148
148
  }
@@ -164,19 +164,19 @@ class ParseGeoPoint {
164
164
  * Creates a GeoPoint with the user's current location, if available.
165
165
  *
166
166
  * @param {object} options The options.
167
- * @param {boolean} [options.enableHighAccuracy=false] A boolean value that indicates the application would like to receive the best possible results.
167
+ * @param {boolean} [options.enableHighAccuracy] A boolean value that indicates the application would like to receive the best possible results.
168
168
  * If true and if the device is able to provide a more accurate position, it will do so.
169
169
  * Note that this can result in slower response times or increased power consumption (with a GPS chip on a mobile device for example).
170
170
  * On the other hand, if false, the device can take the liberty to save resources by responding more quickly and/or using less power. Default: false.
171
- * @param {number} [options.timeout=Infinity] A positive long value representing the maximum length of time (in milliseconds) the device is allowed to take in order to return a position.
171
+ * @param {number} [options.timeout] A positive long value representing the maximum length of time (in milliseconds) the device is allowed to take in order to return a position.
172
172
  * The default value is Infinity, meaning that getCurrentPosition() won't return until the position is available.
173
- * @param {number} [options.maximumAge=0] A positive long value indicating the maximum age in milliseconds of a possible cached position that is acceptable to return.
173
+ * @param {number} [options.maximumAge] A positive long value indicating the maximum age in milliseconds of a possible cached position that is acceptable to return.
174
174
  * If set to 0, it means that the device cannot use a cached position and must attempt to retrieve the real current position.
175
175
  * If set to Infinity the device must return a cached position regardless of its age. Default: 0.
176
176
  * @static
177
177
  * @returns {Promise<Parse.GeoPoint>} User's current location
178
178
  */
179
- static current(options) /*: Promise<ParseGeoPoint>*/{
179
+ static current(options) {
180
180
  return new Promise((resolve, reject) => {
181
181
  navigator.geolocation.getCurrentPosition(location => {
182
182
  resolve(new ParseGeoPoint(location.coords.latitude, location.coords.longitude));
@@ -184,5 +184,4 @@ class ParseGeoPoint {
184
184
  });
185
185
  }
186
186
  }
187
- var _default = ParseGeoPoint;
188
- exports.default = _default;
187
+ var _default = exports.default = ParseGeoPoint;
@@ -19,73 +19,71 @@ exports.updateTrigger = updateTrigger;
19
19
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
20
20
  var _decode = _interopRequireDefault(require("./decode"));
21
21
  var _ParseError = _interopRequireDefault(require("./ParseError"));
22
- function _interopRequireDefault(obj) {
23
- return obj && obj.__esModule ? obj : {
24
- default: obj
22
+ function _interopRequireDefault(e) {
23
+ return e && e.__esModule ? e : {
24
+ default: e
25
25
  };
26
26
  }
27
- /*:: export type HookDeclaration = { functionName: string, url: string } | { className: string, triggerName: string, url: string };*/
28
- /*:: export type HookDeleteArg = { functionName: string } | { className: string, triggerName: string };*/
29
27
  function getFunctions() {
30
28
  return _CoreManager.default.getHooksController().get('functions');
31
29
  }
32
30
  function getTriggers() {
33
31
  return _CoreManager.default.getHooksController().get('triggers');
34
32
  }
35
- function getFunction(name /*: string*/) {
33
+ function getFunction(name) {
36
34
  return _CoreManager.default.getHooksController().get('functions', name);
37
35
  }
38
- function getTrigger(className /*: string*/, triggerName /*: string*/) {
36
+ function getTrigger(className, triggerName) {
39
37
  return _CoreManager.default.getHooksController().get('triggers', className, triggerName);
40
38
  }
41
- function createFunction(functionName /*: string*/, url /*: string*/) {
39
+ function createFunction(functionName, url) {
42
40
  return create({
43
41
  functionName: functionName,
44
42
  url: url
45
43
  });
46
44
  }
47
- function createTrigger(className /*: string*/, triggerName /*: string*/, url /*: string*/) {
45
+ function createTrigger(className, triggerName, url) {
48
46
  return create({
49
47
  className: className,
50
48
  triggerName: triggerName,
51
49
  url: url
52
50
  });
53
51
  }
54
- function create(hook /*: HookDeclaration*/) {
52
+ function create(hook) {
55
53
  return _CoreManager.default.getHooksController().create(hook);
56
54
  }
57
- function updateFunction(functionName /*: string*/, url /*: string*/) {
55
+ function updateFunction(functionName, url) {
58
56
  return update({
59
57
  functionName: functionName,
60
58
  url: url
61
59
  });
62
60
  }
63
- function updateTrigger(className /*: string*/, triggerName /*: string*/, url /*: string*/) {
61
+ function updateTrigger(className, triggerName, url) {
64
62
  return update({
65
63
  className: className,
66
64
  triggerName: triggerName,
67
65
  url: url
68
66
  });
69
67
  }
70
- function update(hook /*: HookDeclaration*/) {
68
+ function update(hook) {
71
69
  return _CoreManager.default.getHooksController().update(hook);
72
70
  }
73
- function removeFunction(functionName /*: string*/) {
71
+ function removeFunction(functionName) {
74
72
  return remove({
75
73
  functionName: functionName
76
74
  });
77
75
  }
78
- function removeTrigger(className /*: string*/, triggerName /*: string*/) {
76
+ function removeTrigger(className, triggerName) {
79
77
  return remove({
80
78
  className: className,
81
79
  triggerName: triggerName
82
80
  });
83
81
  }
84
- function remove(hook /*: HookDeleteArg*/) {
82
+ function remove(hook) {
85
83
  return _CoreManager.default.getHooksController().remove(hook);
86
84
  }
87
85
  const DefaultController = {
88
- get(type /*: string*/, functionName /*:: ?: string*/, triggerName /*:: ?: string*/) {
86
+ get(type, functionName, triggerName) {
89
87
  let url = '/hooks/' + type;
90
88
  if (functionName) {
91
89
  url += '/' + functionName;
@@ -145,7 +143,7 @@ const DefaultController = {
145
143
  }
146
144
  return this.sendRequest('PUT', url, hook);
147
145
  },
148
- sendRequest(method /*: string*/, url /*: string*/, body /*:: ?: any*/) {
146
+ sendRequest(method, url, body) {
149
147
  return _CoreManager.default.getRESTController().request(method, url, body, {
150
148
  useMasterKey: true
151
149
  }).then(res => {
@@ -7,12 +7,12 @@ exports.default = void 0;
7
7
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
8
8
  var _ParseError = _interopRequireDefault(require("./ParseError"));
9
9
  var _ParseObject = _interopRequireDefault(require("./ParseObject"));
10
- function _interopRequireDefault(obj) {
11
- return obj && obj.__esModule ? obj : {
12
- default: obj
10
+ function _interopRequireDefault(e) {
11
+ return e && e.__esModule ? e : {
12
+ default: e
13
13
  };
14
14
  }
15
- const DEVICE_TYPES /*: DeviceInterface*/ = {
15
+ const DEVICE_TYPES = {
16
16
  IOS: 'ios',
17
17
  MACOS: 'macos',
18
18
  TVOS: 'tvos',
@@ -36,7 +36,7 @@ class ParseInstallation extends _ParseObject.default {
36
36
  /**
37
37
  * @param {object} attributes The initial set of data to store in the object.
38
38
  */
39
- constructor(attributes /*:: ?: AttributeMap*/) {
39
+ constructor(attributes) {
40
40
  super('_Installation');
41
41
  if (attributes && typeof attributes === 'object') {
42
42
  if (!this.set(attributes)) {
@@ -206,7 +206,7 @@ class ParseInstallation extends _ParseObject.default {
206
206
  * @static
207
207
  * @returns {object}
208
208
  */
209
- static get DEVICE_TYPES() /*: DeviceInterface*/{
209
+ static get DEVICE_TYPES() {
210
210
  return DEVICE_TYPES;
211
211
  }
212
212
 
@@ -217,7 +217,7 @@ class ParseInstallation extends _ParseObject.default {
217
217
  * @param {...any} args
218
218
  * @returns {Promise}
219
219
  */
220
- async fetch(...args) /*: Promise<ParseInstallation>*/{
220
+ async fetch(...args) {
221
221
  try {
222
222
  await super.fetch.apply(this, args);
223
223
  } catch (e) {
@@ -242,7 +242,7 @@ class ParseInstallation extends _ParseObject.default {
242
242
  * @param {...any} args
243
243
  * @returns {Promise}
244
244
  */
245
- async save(...args) /*: Promise<this>*/{
245
+ async save(...args) {
246
246
  try {
247
247
  await super.save.apply(this, args);
248
248
  } catch (e) {
@@ -276,11 +276,10 @@ class ParseInstallation extends _ParseObject.default {
276
276
  *
277
277
  * @returns {Promise} A promise that resolves to the local installation object.
278
278
  */
279
- static currentInstallation() /*: Promise<ParseInstallation>*/{
279
+ static currentInstallation() {
280
280
  return _CoreManager.default.getInstallationController().currentInstallation();
281
281
  }
282
282
  }
283
283
  _ParseObject.default.registerSubclass('_Installation', ParseInstallation);
284
284
  module.exports = ParseInstallation;
285
- var _default = ParseInstallation;
286
- exports.default = _default;
285
+ var _default = exports.default = ParseInstallation;
@@ -6,16 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _LiveQueryClient = _interopRequireDefault(require("./LiveQueryClient"));
8
8
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
9
- function _interopRequireDefault(obj) {
10
- return obj && obj.__esModule ? obj : {
11
- default: obj
9
+ function _interopRequireDefault(e) {
10
+ return e && e.__esModule ? e : {
11
+ default: e
12
12
  };
13
13
  }
14
- /**
15
- * @flow
16
- */
17
-
18
- function getLiveQueryClient() /*: Promise<LiveQueryClient>*/{
14
+ function getLiveQueryClient() {
19
15
  return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
20
16
  }
21
17
 
@@ -61,7 +57,7 @@ class LiveQuery {
61
57
  * After open is called, the LiveQuery will try to send a connect request
62
58
  * to the LiveQuery server.
63
59
  */
64
- async open() /*: void*/{
60
+ async open() {
65
61
  const liveQueryClient = await getLiveQueryClient();
66
62
  liveQueryClient.open();
67
63
  }
@@ -73,19 +69,18 @@ class LiveQuery {
73
69
  * If you call query.subscribe() after this, we'll create a new WebSocket
74
70
  * connection to the LiveQuery server.
75
71
  */
76
- async close() /*: void*/{
72
+ async close() {
77
73
  const liveQueryClient = await getLiveQueryClient();
78
74
  liveQueryClient.close();
79
75
  }
80
76
  }
81
- var _default = LiveQuery;
82
- exports.default = _default;
77
+ var _default = exports.default = LiveQuery;
83
78
  let defaultLiveQueryClient;
84
79
  const DefaultLiveQueryController = {
85
- setDefaultLiveQueryClient(liveQueryClient /*: LiveQueryClient*/) {
80
+ setDefaultLiveQueryClient(liveQueryClient) {
86
81
  defaultLiveQueryClient = liveQueryClient;
87
82
  },
88
- async getDefaultLiveQueryClient() /*: Promise<LiveQueryClient>*/{
83
+ async getDefaultLiveQueryClient() {
89
84
  if (defaultLiveQueryClient) {
90
85
  return defaultLiveQueryClient;
91
86
  }