parse 5.2.0-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 (247) hide show
  1. package/dist/parse.js +10102 -15029
  2. package/dist/parse.min.js +2 -2
  3. package/dist/parse.weapp.js +10093 -15165
  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 +308 -484
  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 +2 -6
  70. package/lib/node/AnonymousUtils.js +7 -12
  71. package/lib/node/Cloud.js +8 -8
  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 +17 -36
  76. package/lib/node/FacebookUtils.js +1 -5
  77. package/lib/node/IndexedDBStorageController.js +14 -10
  78. package/lib/node/InstallationController.js +9 -10
  79. package/lib/node/LiveQueryClient.js +12 -14
  80. package/lib/node/LiveQuerySubscription.js +3 -4
  81. package/lib/node/LocalDatastore.js +20 -20
  82. package/lib/node/LocalDatastoreController.default.js +8 -9
  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 +9 -19
  87. package/lib/node/OfflineQuery.js +37 -23
  88. package/lib/node/Parse.js +33 -47
  89. package/lib/node/ParseACL.js +18 -27
  90. package/lib/node/ParseCLP.js +35 -37
  91. package/lib/node/ParseConfig.js +7 -14
  92. package/lib/node/ParseError.js +457 -458
  93. package/lib/node/ParseFile.js +24 -44
  94. package/lib/node/ParseGeoPoint.js +16 -17
  95. package/lib/node/ParseHooks.js +13 -15
  96. package/lib/node/ParseInstallation.js +7 -8
  97. package/lib/node/ParseLiveQuery.js +6 -11
  98. package/lib/node/ParseObject.js +139 -170
  99. package/lib/node/ParseOp.js +32 -44
  100. package/lib/node/ParsePolygon.js +11 -17
  101. package/lib/node/ParseQuery.js +97 -120
  102. package/lib/node/ParseRelation.js +7 -16
  103. package/lib/node/ParseRole.js +7 -8
  104. package/lib/node/ParseSchema.js +26 -39
  105. package/lib/node/ParseSession.js +7 -8
  106. package/lib/node/ParseUser.js +73 -84
  107. package/lib/node/Push.js +4 -9
  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 +2 -3
  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/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 +2 -4
  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 +308 -484
  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 +19 -25
@@ -14,21 +14,11 @@ function _interopRequireDefault(obj) {
14
14
  default: obj
15
15
  };
16
16
  }
17
- /*:: export type AuthData = { [key: string]: any };*/
18
- /*:: export type AuthProviderType = {
19
- authenticate?(options: {
20
- error?: (provider: AuthProviderType, error: string | any) => void,
21
- success?: (provider: AuthProviderType, result: AuthData) => void,
22
- }): void,
23
- restoreAuthentication(authData: any): boolean;
24
- getAuthType(): string;
25
- deauthenticate?(): void;
26
- };*/
27
17
  const CURRENT_USER_KEY = 'currentUser';
28
18
  let canUseCurrentUser = !_CoreManager.default.get('IS_NODE');
29
19
  let currentUserCacheMatchesDisk = false;
30
- let currentUserCache /*: ParseUser | null*/ = null;
31
- const authProviders /*: { [key: string]: AuthProviderType }*/ = {};
20
+ let currentUserCache = null;
21
+ const authProviders = {};
32
22
 
33
23
  /**
34
24
  * <p>A Parse.User object is a local representation of a user persisted to the
@@ -44,7 +34,7 @@ class ParseUser extends _ParseObject.default {
44
34
  /**
45
35
  * @param {object} attributes The initial set of data to store in the user.
46
36
  */
47
- constructor(attributes /*:: ?: AttributeMap*/) {
37
+ constructor(attributes) {
48
38
  super('_User');
49
39
  if (attributes && typeof attributes === 'object') {
50
40
  if (!this.set(attributes || {})) {
@@ -60,9 +50,9 @@ class ParseUser extends _ParseObject.default {
60
50
  * @returns {Promise} A promise that is resolved when the replacement
61
51
  * token has been fetched.
62
52
  */
63
- _upgradeToRevocableSession(options /*: RequestOptions*/) /*: Promise<void>*/{
53
+ _upgradeToRevocableSession(options) {
64
54
  options = options || {};
65
- const upgradeOptions /*: RequestOptions*/ = {};
55
+ const upgradeOptions = {};
66
56
  if (options.hasOwnProperty('useMasterKey')) {
67
57
  upgradeOptions.useMasterKey = options.useMasterKey;
68
58
  }
@@ -86,7 +76,7 @@ class ParseUser extends _ParseObject.default {
86
76
  * @param {object} saveOpts useMasterKey / sessionToken
87
77
  * @returns {Promise} A promise that is fulfilled with the user is linked
88
78
  */
89
- linkWith(provider /*: AuthProviderType*/, options /*: { authData?: AuthData }*/, saveOpts /*: FullOptions*/ = {}) /*: Promise<ParseUser>*/{
79
+ linkWith(provider, options, saveOpts = {}) {
90
80
  saveOpts.sessionToken = saveOpts.sessionToken || this.getSessionToken() || '';
91
81
  let authType;
92
82
  if (typeof provider === 'string') {
@@ -126,7 +116,7 @@ class ParseUser extends _ParseObject.default {
126
116
  return new Promise((resolve, reject) => {
127
117
  provider.authenticate({
128
118
  success: (provider, result) => {
129
- const opts /*: { authData?: AuthData }*/ = {};
119
+ const opts = {};
130
120
  opts.authData = result;
131
121
  this.linkWith(provider, opts, saveOpts).then(() => {
132
122
  resolve(this);
@@ -150,7 +140,7 @@ class ParseUser extends _ParseObject.default {
150
140
  * @deprecated since 2.9.0 see {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith}
151
141
  * @returns {Promise}
152
142
  */
153
- _linkWith(provider /*: any*/, options /*: { authData?: AuthData }*/, saveOpts /*: FullOptions*/ = {}) /*: Promise<ParseUser>*/{
143
+ _linkWith(provider, options, saveOpts = {}) {
154
144
  return this.linkWith(provider, options, saveOpts);
155
145
  }
156
146
 
@@ -160,7 +150,7 @@ class ParseUser extends _ParseObject.default {
160
150
  *
161
151
  * @param provider
162
152
  */
163
- _synchronizeAuthData(provider /*: string | AuthProviderType*/) {
153
+ _synchronizeAuthData(provider) {
164
154
  if (!this.isCurrent() || !provider) {
165
155
  return;
166
156
  }
@@ -220,7 +210,7 @@ class ParseUser extends _ParseObject.default {
220
210
  * @returns {Promise} A promise that is fulfilled when the unlinking
221
211
  * finishes.
222
212
  */
223
- _unlinkFrom(provider /*: any*/, options /*:: ?: FullOptions*/) /*: Promise<ParseUser>*/{
213
+ _unlinkFrom(provider, options) {
224
214
  return this.linkWith(provider, {
225
215
  authData: null
226
216
  }, options).then(() => {
@@ -235,7 +225,7 @@ class ParseUser extends _ParseObject.default {
235
225
  * @param {object} provider service to link to
236
226
  * @returns {boolean} true if link was successful
237
227
  */
238
- _isLinked(provider /*: any*/) /*: boolean*/{
228
+ _isLinked(provider) {
239
229
  let authType;
240
230
  if (typeof provider === 'string') {
241
231
  authType = provider;
@@ -268,7 +258,7 @@ class ParseUser extends _ParseObject.default {
268
258
  *
269
259
  * @param {object} provider service to logout of
270
260
  */
271
- _logOutWith(provider /*: any*/) {
261
+ _logOutWith(provider) {
272
262
  if (!this.isCurrent()) {
273
263
  return;
274
264
  }
@@ -286,7 +276,7 @@ class ParseUser extends _ParseObject.default {
286
276
  *
287
277
  * @returns {object} sessionToken
288
278
  */
289
- _preserveFieldsOnFetch() /*: AttributeMap*/{
279
+ _preserveFieldsOnFetch() {
290
280
  return {
291
281
  sessionToken: this.get('sessionToken')
292
282
  };
@@ -297,7 +287,7 @@ class ParseUser extends _ParseObject.default {
297
287
  *
298
288
  * @returns {boolean} true if user is cached on disk
299
289
  */
300
- isCurrent() /*: boolean*/{
290
+ isCurrent() {
301
291
  const current = ParseUser.current();
302
292
  return !!current && current.id === this.id;
303
293
  }
@@ -307,7 +297,7 @@ class ParseUser extends _ParseObject.default {
307
297
  *
308
298
  * @returns {Promise<boolean>} true if user is cached on disk
309
299
  */
310
- async isCurrentAsync() /*: Promise<boolean>*/{
300
+ async isCurrentAsync() {
311
301
  const current = await ParseUser.currentAsync();
312
302
  return !!current && current.id === this.id;
313
303
  }
@@ -318,7 +308,7 @@ class ParseUser extends _ParseObject.default {
318
308
  authData.anonymous = null;
319
309
  }
320
310
  }
321
- restoreAnonimity(anonymousData /*: any*/) {
311
+ restoreAnonimity(anonymousData) {
322
312
  if (anonymousData) {
323
313
  const authData = this.get('authData');
324
314
  authData.anonymous = anonymousData;
@@ -330,7 +320,7 @@ class ParseUser extends _ParseObject.default {
330
320
  *
331
321
  * @returns {string}
332
322
  */
333
- getUsername() /*: string | null*/{
323
+ getUsername() {
334
324
  const username = this.get('username');
335
325
  if (username == null || typeof username === 'string') {
336
326
  return username;
@@ -343,7 +333,7 @@ class ParseUser extends _ParseObject.default {
343
333
  *
344
334
  * @param {string} username
345
335
  */
346
- setUsername(username /*: string*/) {
336
+ setUsername(username) {
347
337
  this.stripAnonymity();
348
338
  this.set('username', username);
349
339
  }
@@ -353,7 +343,7 @@ class ParseUser extends _ParseObject.default {
353
343
  *
354
344
  * @param {string} password User's Password
355
345
  */
356
- setPassword(password /*: string*/) {
346
+ setPassword(password) {
357
347
  this.set('password', password);
358
348
  }
359
349
 
@@ -362,7 +352,7 @@ class ParseUser extends _ParseObject.default {
362
352
  *
363
353
  * @returns {string} User's Email
364
354
  */
365
- getEmail() /*: string | null*/{
355
+ getEmail() {
366
356
  const email = this.get('email');
367
357
  if (email == null || typeof email === 'string') {
368
358
  return email;
@@ -376,7 +366,7 @@ class ParseUser extends _ParseObject.default {
376
366
  * @param {string} email
377
367
  * @returns {boolean}
378
368
  */
379
- setEmail(email /*: string*/) {
369
+ setEmail(email) {
380
370
  return this.set('email', email);
381
371
  }
382
372
 
@@ -387,7 +377,7 @@ class ParseUser extends _ParseObject.default {
387
377
  *
388
378
  * @returns {string} the session token, or undefined
389
379
  */
390
- getSessionToken() /*: string | null*/{
380
+ getSessionToken() {
391
381
  const token = this.get('sessionToken');
392
382
  if (token == null || typeof token === 'string') {
393
383
  return token;
@@ -400,7 +390,7 @@ class ParseUser extends _ParseObject.default {
400
390
  *
401
391
  * @returns {boolean} whether this user is the current user and is logged in.
402
392
  */
403
- authenticated() /*: boolean*/{
393
+ authenticated() {
404
394
  const current = ParseUser.current();
405
395
  return !!this.get('sessionToken') && !!current && current.id === this.id;
406
396
  }
@@ -418,9 +408,9 @@ class ParseUser extends _ParseObject.default {
418
408
  * @returns {Promise} A promise that is fulfilled when the signup
419
409
  * finishes.
420
410
  */
421
- signUp(attrs /*: AttributeMap*/, options /*:: ?: FullOptions & { context?: AttributeMap }*/) /*: Promise<ParseUser>*/{
411
+ signUp(attrs, options) {
422
412
  options = options || {};
423
- const signupOptions /*: FullOptions & { context?: AttributeMap }*/ = {};
413
+ const signupOptions = {};
424
414
  if (options.hasOwnProperty('useMasterKey')) {
425
415
  signupOptions.useMasterKey = options.useMasterKey;
426
416
  }
@@ -445,9 +435,9 @@ class ParseUser extends _ParseObject.default {
445
435
  * @returns {Promise} A promise that is fulfilled with the user when
446
436
  * the login is complete.
447
437
  */
448
- logIn(options /*: FullOptions & { context?: AttributeMap }*/ = {}) /*: Promise<ParseUser>*/{
438
+ logIn(options = {}) {
449
439
  options = options || {};
450
- const loginOptions /*: FullOptions & { context?: AttributeMap }*/ = {
440
+ const loginOptions = {
451
441
  usePost: true
452
442
  };
453
443
  if (options.hasOwnProperty('useMasterKey')) {
@@ -473,7 +463,7 @@ class ParseUser extends _ParseObject.default {
473
463
  * @param {...any} args
474
464
  * @returns {Promise}
475
465
  */
476
- async save(...args) /*: Promise<this>*/{
466
+ async save(...args) {
477
467
  await super.save.apply(this, args);
478
468
  const current = await this.isCurrentAsync();
479
469
  if (current) {
@@ -489,7 +479,7 @@ class ParseUser extends _ParseObject.default {
489
479
  * @param {...any} args
490
480
  * @returns {Parse.User}
491
481
  */
492
- async destroy(...args) /*: Promise<ParseUser | void>*/{
482
+ async destroy(...args) {
493
483
  await super.destroy.apply(this, args);
494
484
  const current = await this.isCurrentAsync();
495
485
  if (current) {
@@ -505,7 +495,7 @@ class ParseUser extends _ParseObject.default {
505
495
  * @param {...any} args
506
496
  * @returns {Parse.User}
507
497
  */
508
- async fetch(...args) /*: Promise<ParseUser>*/{
498
+ async fetch(...args) {
509
499
  await super.fetch.apply(this, args);
510
500
  const current = await this.isCurrentAsync();
511
501
  if (current) {
@@ -521,7 +511,7 @@ class ParseUser extends _ParseObject.default {
521
511
  * @param {...any} args
522
512
  * @returns {Parse.User}
523
513
  */
524
- async fetchWithInclude(...args) /*: Promise<ParseUser>*/{
514
+ async fetchWithInclude(...args) {
525
515
  await super.fetchWithInclude.apply(this, args);
526
516
  const current = await this.isCurrentAsync();
527
517
  if (current) {
@@ -535,11 +525,11 @@ class ParseUser extends _ParseObject.default {
535
525
  *
536
526
  * @param {string} password The password to be verified.
537
527
  * @param {object} options The options.
538
- * @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
528
+ * @param {boolean} [options.ignoreEmailVerification] Set to `true` to bypass email verification and verify
539
529
  * the password regardless of whether the email has been verified. This requires the master key.
540
530
  * @returns {Promise} A promise that is fulfilled with a user when the password is correct.
541
531
  */
542
- verifyPassword(password /*: string*/, options /*:: ?: RequestOptions*/) /*: Promise<ParseUser>*/{
532
+ verifyPassword(password, options) {
543
533
  const username = this.getUsername() || '';
544
534
  return ParseUser.verifyPassword(username, password, options);
545
535
  }
@@ -555,7 +545,7 @@ class ParseUser extends _ParseObject.default {
555
545
  * @static
556
546
  * @returns {Parse.User} The newly extended Parse.User class
557
547
  */
558
- static extend(protoProps /*: { [prop: string]: any }*/, classProps /*: { [prop: string]: any }*/) {
548
+ static extend(protoProps, classProps) {
559
549
  if (protoProps) {
560
550
  for (const prop in protoProps) {
561
551
  if (prop !== 'className') {
@@ -590,7 +580,7 @@ class ParseUser extends _ParseObject.default {
590
580
  * @static
591
581
  * @returns {Parse.Object} The currently logged in Parse.User.
592
582
  */
593
- static current() /*: ParseUser | null*/{
583
+ static current() {
594
584
  if (!canUseCurrentUser) {
595
585
  return null;
596
586
  }
@@ -605,7 +595,7 @@ class ParseUser extends _ParseObject.default {
605
595
  * @returns {Promise} A Promise that is resolved with the currently
606
596
  * logged in Parse User
607
597
  */
608
- static currentAsync() /*: Promise<ParseUser | null>*/{
598
+ static currentAsync() {
609
599
  if (!canUseCurrentUser) {
610
600
  return Promise.resolve(null);
611
601
  }
@@ -627,7 +617,7 @@ class ParseUser extends _ParseObject.default {
627
617
  * @returns {Promise} A promise that is fulfilled with the user when
628
618
  * the signup completes.
629
619
  */
630
- static signUp(username /*: string*/, password /*: string*/, attrs /*: AttributeMap*/, options /*:: ?: FullOptions*/) {
620
+ static signUp(username, password, attrs, options) {
631
621
  attrs = attrs || {};
632
622
  attrs.username = username;
633
623
  attrs.password = password;
@@ -647,7 +637,7 @@ class ParseUser extends _ParseObject.default {
647
637
  * @returns {Promise} A promise that is fulfilled with the user when
648
638
  * the login completes.
649
639
  */
650
- static logIn(username /*: string*/, password /*: string*/, options /*:: ?: FullOptions*/) {
640
+ static logIn(username, password, options) {
651
641
  if (typeof username !== 'string') {
652
642
  return Promise.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Username must be a string.'));
653
643
  } else if (typeof password !== 'string') {
@@ -674,7 +664,7 @@ class ParseUser extends _ParseObject.default {
674
664
  * @returns {Promise} A promise that is fulfilled with the user when
675
665
  * the login completes.
676
666
  */
677
- static logInWithAdditionalAuth(username /*: string*/, password /*: string*/, authData /*: AuthData*/, options /*:: ?: FullOptions*/) {
667
+ static logInWithAdditionalAuth(username, password, authData, options) {
678
668
  if (typeof username !== 'string') {
679
669
  return Promise.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Username must be a string.'));
680
670
  }
@@ -703,7 +693,7 @@ class ParseUser extends _ParseObject.default {
703
693
  * @returns {Promise} A promise that is fulfilled with the user when
704
694
  * the login completes.
705
695
  */
706
- static loginAs(userId /*: string*/) {
696
+ static loginAs(userId) {
707
697
  if (!userId) {
708
698
  throw new _ParseError.default(_ParseError.default.USERNAME_MISSING, 'Cannot log in as user with an empty user id');
709
699
  }
@@ -723,12 +713,12 @@ class ParseUser extends _ParseObject.default {
723
713
  * @returns {Promise} A promise that is fulfilled with the user when
724
714
  * the login completes.
725
715
  */
726
- static become(sessionToken /*: string*/, options /*:: ?: RequestOptions*/) {
716
+ static become(sessionToken, options) {
727
717
  if (!canUseCurrentUser) {
728
718
  throw new Error('It is not memory-safe to become a user in a server environment');
729
719
  }
730
720
  options = options || {};
731
- const becomeOptions /*: RequestOptions*/ = {
721
+ const becomeOptions = {
732
722
  sessionToken: sessionToken
733
723
  };
734
724
  if (options.hasOwnProperty('useMasterKey')) {
@@ -747,9 +737,9 @@ class ParseUser extends _ParseObject.default {
747
737
  * @static
748
738
  * @returns {Promise} A promise that is fulfilled with the user is fetched.
749
739
  */
750
- static me(sessionToken /*: string*/, options /*: RequestOptions*/ = {}) {
740
+ static me(sessionToken, options = {}) {
751
741
  const controller = _CoreManager.default.getUserController();
752
- const meOptions /*: RequestOptions*/ = {
742
+ const meOptions = {
753
743
  sessionToken: sessionToken
754
744
  };
755
745
  if (options.useMasterKey) {
@@ -769,7 +759,7 @@ class ParseUser extends _ParseObject.default {
769
759
  * @returns {Promise} A promise that is fulfilled with the user when
770
760
  * the login completes.
771
761
  */
772
- static hydrate(userJSON /*: AttributeMap*/) {
762
+ static hydrate(userJSON) {
773
763
  const controller = _CoreManager.default.getUserController();
774
764
  const user = new this();
775
765
  return controller.hydrate(user, userJSON);
@@ -785,7 +775,7 @@ class ParseUser extends _ParseObject.default {
785
775
  * @static
786
776
  * @returns {Promise}
787
777
  */
788
- static logInWith(provider /*: any*/, options /*: { authData?: AuthData }*/, saveOpts /*:: ?: FullOptions*/) /*: Promise<ParseUser>*/{
778
+ static logInWith(provider, options, saveOpts) {
789
779
  const user = new this();
790
780
  return user.linkWith(provider, options, saveOpts);
791
781
  }
@@ -800,7 +790,7 @@ class ParseUser extends _ParseObject.default {
800
790
  * @returns {Promise} A promise that is resolved when the session is
801
791
  * destroyed on the server.
802
792
  */
803
- static logOut(options /*: RequestOptions*/ = {}) {
793
+ static logOut(options = {}) {
804
794
  const controller = _CoreManager.default.getUserController();
805
795
  return controller.logOut(options);
806
796
  }
@@ -816,9 +806,9 @@ class ParseUser extends _ParseObject.default {
816
806
  * @static
817
807
  * @returns {Promise}
818
808
  */
819
- static requestPasswordReset(email /*: string*/, options /*:: ?: RequestOptions*/) {
809
+ static requestPasswordReset(email, options) {
820
810
  options = options || {};
821
- const requestOptions /*: RequestOptions*/ = {};
811
+ const requestOptions = {};
822
812
  if (options.hasOwnProperty('useMasterKey')) {
823
813
  requestOptions.useMasterKey = options.useMasterKey;
824
814
  }
@@ -835,9 +825,9 @@ class ParseUser extends _ParseObject.default {
835
825
  * @static
836
826
  * @returns {Promise}
837
827
  */
838
- static requestEmailVerification(email /*: string*/, options /*:: ?: RequestOptions*/) {
828
+ static requestEmailVerification(email, options) {
839
829
  options = options || {};
840
- const requestOptions /*: RequestOptions*/ = {};
830
+ const requestOptions = {};
841
831
  if (options.hasOwnProperty('useMasterKey')) {
842
832
  requestOptions.useMasterKey = options.useMasterKey;
843
833
  }
@@ -852,11 +842,11 @@ class ParseUser extends _ParseObject.default {
852
842
  * @param {string} username The username of the user whose password should be verified.
853
843
  * @param {string} password The password to be verified.
854
844
  * @param {object} options The options.
855
- * @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
845
+ * @param {boolean} [options.ignoreEmailVerification] Set to `true` to bypass email verification and verify
856
846
  * the password regardless of whether the email has been verified. This requires the master key.
857
847
  * @returns {Promise} A promise that is fulfilled with a user when the password is correct.
858
848
  */
859
- static verifyPassword(username /*: string*/, password /*: string*/, options /*:: ?: RequestOptions*/) {
849
+ static verifyPassword(username, password, options) {
860
850
  if (typeof username !== 'string') {
861
851
  return Promise.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Username must be a string.'));
862
852
  }
@@ -876,7 +866,7 @@ class ParseUser extends _ParseObject.default {
876
866
  * @param {boolean} isAllowed Whether or not to allow custom User class
877
867
  * @static
878
868
  */
879
- static allowCustomUserClass(isAllowed /*: boolean*/) {
869
+ static allowCustomUserClass(isAllowed) {
880
870
  _CoreManager.default.set('PERFORM_USER_REWRITE', !isAllowed);
881
871
  }
882
872
 
@@ -894,7 +884,7 @@ class ParseUser extends _ParseObject.default {
894
884
  * completed. If a replacement session token is requested, the promise
895
885
  * will be resolved after a new token has been fetched.
896
886
  */
897
- static enableRevocableSession(options /*:: ?: RequestOptions*/) {
887
+ static enableRevocableSession(options) {
898
888
  options = options || {};
899
889
  _CoreManager.default.set('FORCE_REVOCABLE_SESSION', true);
900
890
  if (canUseCurrentUser) {
@@ -940,7 +930,7 @@ class ParseUser extends _ParseObject.default {
940
930
  * @see {@link https://docs.parseplatform.org/js/guide/#custom-authentication-module Custom Authentication Module}
941
931
  * @static
942
932
  */
943
- static _registerAuthenticationProvider(provider /*: any*/) {
933
+ static _registerAuthenticationProvider(provider) {
944
934
  authProviders[provider.getAuthType()] = provider;
945
935
  // Synchronize the current user with the auth provider.
946
936
  ParseUser.currentAsync().then(current => {
@@ -959,7 +949,7 @@ class ParseUser extends _ParseObject.default {
959
949
  * @static
960
950
  * @returns {Promise}
961
951
  */
962
- static _logInWith(provider /*: any*/, options /*: { authData?: AuthData }*/, saveOpts /*:: ?: FullOptions*/) {
952
+ static _logInWith(provider, options, saveOpts) {
963
953
  const user = new this();
964
954
  return user.linkWith(provider, options, saveOpts);
965
955
  }
@@ -967,7 +957,7 @@ class ParseUser extends _ParseObject.default {
967
957
  currentUserCache = null;
968
958
  currentUserCacheMatchesDisk = false;
969
959
  }
970
- static _setCurrentUserCache(user /*: ParseUser*/) {
960
+ static _setCurrentUserCache(user) {
971
961
  currentUserCache = user;
972
962
  }
973
963
  }
@@ -999,7 +989,7 @@ const DefaultController = {
999
989
  user._synchronizeAllAuthData();
1000
990
  return DefaultController.updateUserOnDisk(user);
1001
991
  },
1002
- currentUser() /*: ParseUser | null*/{
992
+ currentUser() {
1003
993
  if (currentUserCache) {
1004
994
  return currentUserCache;
1005
995
  }
@@ -1039,7 +1029,7 @@ const DefaultController = {
1039
1029
  current._synchronizeAllAuthData();
1040
1030
  return current;
1041
1031
  },
1042
- currentUserAsync() /*: Promise<ParseUser | null>*/{
1032
+ currentUserAsync() {
1043
1033
  if (currentUserCache) {
1044
1034
  return Promise.resolve(currentUserCache);
1045
1035
  }
@@ -1077,7 +1067,7 @@ const DefaultController = {
1077
1067
  return Promise.resolve(current);
1078
1068
  });
1079
1069
  },
1080
- signUp(user /*: ParseUser*/, attrs /*: AttributeMap*/, options /*: RequestOptions*/) /*: Promise<ParseUser>*/{
1070
+ signUp(user, attrs, options) {
1081
1071
  const username = attrs && attrs.username || user.get('username');
1082
1072
  const password = attrs && attrs.password || user.get('password');
1083
1073
  if (!username || !username.length) {
@@ -1097,7 +1087,7 @@ const DefaultController = {
1097
1087
  return user;
1098
1088
  });
1099
1089
  },
1100
- logIn(user /*: ParseUser*/, options /*: RequestOptions*/) /*: Promise<ParseUser>*/{
1090
+ logIn(user, options) {
1101
1091
  const RESTController = _CoreManager.default.getRESTController();
1102
1092
  const stateController = _CoreManager.default.getObjectStateController();
1103
1093
  const auth = {
@@ -1119,7 +1109,7 @@ const DefaultController = {
1119
1109
  return DefaultController.setCurrentUser(user);
1120
1110
  });
1121
1111
  },
1122
- loginAs(user /*: ParseUser*/, userId /*: string*/) /*: Promise<ParseUser>*/{
1112
+ loginAs(user, userId) {
1123
1113
  const RESTController = _CoreManager.default.getRESTController();
1124
1114
  return RESTController.request('POST', 'loginAs', {
1125
1115
  userId
@@ -1134,7 +1124,7 @@ const DefaultController = {
1134
1124
  return DefaultController.setCurrentUser(user);
1135
1125
  });
1136
1126
  },
1137
- become(user /*: ParseUser*/, options /*: RequestOptions*/) /*: Promise<ParseUser>*/{
1127
+ become(user, options) {
1138
1128
  const RESTController = _CoreManager.default.getRESTController();
1139
1129
  return RESTController.request('GET', 'users/me', {}, options).then(response => {
1140
1130
  user._finishFetch(response);
@@ -1142,7 +1132,7 @@ const DefaultController = {
1142
1132
  return DefaultController.setCurrentUser(user);
1143
1133
  });
1144
1134
  },
1145
- hydrate(user /*: ParseUser*/, userJSON /*: AttributeMap*/) /*: Promise<ParseUser>*/{
1135
+ hydrate(user, userJSON) {
1146
1136
  user._finishFetch(userJSON);
1147
1137
  user._setExisted(true);
1148
1138
  if (userJSON.sessionToken && canUseCurrentUser) {
@@ -1151,7 +1141,7 @@ const DefaultController = {
1151
1141
  return Promise.resolve(user);
1152
1142
  }
1153
1143
  },
1154
- me(user /*: ParseUser*/, options /*: RequestOptions*/) /*: Promise<ParseUser>*/{
1144
+ me(user, options) {
1155
1145
  const RESTController = _CoreManager.default.getRESTController();
1156
1146
  return RESTController.request('GET', 'users/me', {}, options).then(response => {
1157
1147
  user._finishFetch(response);
@@ -1159,7 +1149,7 @@ const DefaultController = {
1159
1149
  return user;
1160
1150
  });
1161
1151
  },
1162
- logOut(options /*: RequestOptions*/) /*: Promise<void>*/{
1152
+ logOut(options) {
1163
1153
  const RESTController = _CoreManager.default.getRESTController();
1164
1154
  if (options.sessionToken) {
1165
1155
  return RESTController.request('POST', 'logout', {}, options);
@@ -1186,13 +1176,13 @@ const DefaultController = {
1186
1176
  return promise;
1187
1177
  });
1188
1178
  },
1189
- requestPasswordReset(email /*: string*/, options /*: RequestOptions*/) {
1179
+ requestPasswordReset(email, options) {
1190
1180
  const RESTController = _CoreManager.default.getRESTController();
1191
1181
  return RESTController.request('POST', 'requestPasswordReset', {
1192
1182
  email: email
1193
1183
  }, options);
1194
1184
  },
1195
- async upgradeToRevocableSession(user /*: ParseUser*/, options /*: RequestOptions*/) {
1185
+ async upgradeToRevocableSession(user, options) {
1196
1186
  const token = user.getSessionToken();
1197
1187
  if (!token) {
1198
1188
  return Promise.reject(new _ParseError.default(_ParseError.default.SESSION_MISSING, 'Cannot upgrade a user with no session token'));
@@ -1209,7 +1199,7 @@ const DefaultController = {
1209
1199
  }
1210
1200
  return Promise.resolve(user);
1211
1201
  },
1212
- linkWith(user /*: ParseUser*/, authData /*: AuthData*/, options /*: FullOptions*/) {
1202
+ linkWith(user, authData, options) {
1213
1203
  return user.save({
1214
1204
  authData
1215
1205
  }, options).then(() => {
@@ -1219,7 +1209,7 @@ const DefaultController = {
1219
1209
  return user;
1220
1210
  });
1221
1211
  },
1222
- verifyPassword(username /*: string*/, password /*: string*/, options /*: RequestOptions*/) {
1212
+ verifyPassword(username, password, options) {
1223
1213
  const RESTController = _CoreManager.default.getRESTController();
1224
1214
  const data = {
1225
1215
  username,
@@ -1230,7 +1220,7 @@ const DefaultController = {
1230
1220
  };
1231
1221
  return RESTController.request('GET', 'verifyPassword', data, options);
1232
1222
  },
1233
- requestEmailVerification(email /*: string*/, options /*: RequestOptions*/) {
1223
+ requestEmailVerification(email, options) {
1234
1224
  const RESTController = _CoreManager.default.getRESTController();
1235
1225
  return RESTController.request('POST', 'verificationEmailRequest', {
1236
1226
  email: email
@@ -1239,5 +1229,4 @@ const DefaultController = {
1239
1229
  };
1240
1230
  _CoreManager.default.setParseUser(ParseUser);
1241
1231
  _CoreManager.default.setUserController(DefaultController);
1242
- var _default = ParseUser;
1243
- exports.default = _default;
1232
+ var _default = exports.default = ParseUser;
package/lib/node/Push.js CHANGED
@@ -12,12 +12,6 @@ function _interopRequireDefault(obj) {
12
12
  default: obj
13
13
  };
14
14
  }
15
- /*:: export type PushData = {
16
- where?: WhereClause | ParseQuery,
17
- push_time?: Date | string,
18
- expiration_time?: Date | string,
19
- expiration_interval?: number,
20
- };*/
21
15
  /**
22
16
  * Contains functions to deal with Push in Parse.
23
17
  *
@@ -25,6 +19,7 @@ function _interopRequireDefault(obj) {
25
19
  * @static
26
20
  * @hideconstructor
27
21
  */
22
+
28
23
  /**
29
24
  * Sends a push notification.
30
25
  * **Available in Cloud Code only.**
@@ -53,7 +48,7 @@ function _interopRequireDefault(obj) {
53
48
  * @returns {Promise} A promise that is fulfilled when the push request
54
49
  * completes and returns `pushStatusId`.
55
50
  */
56
- function send(data /*: PushData*/, options /*: FullOptions*/ = {}) /*: Promise<string>*/{
51
+ function send(data, options = {}) {
57
52
  if (data.where && data.where instanceof _ParseQuery.default) {
58
53
  data.where = data.where.toJSON().where;
59
54
  }
@@ -88,7 +83,7 @@ function send(data /*: PushData*/, options /*: FullOptions*/ = {}) /*: Promise<s
88
83
  * </ul>
89
84
  * @returns {Parse.Object} Status of Push.
90
85
  */
91
- function getPushStatus(pushStatusId /*: string*/, options /*: FullOptions*/ = {}) /*: Promise<ParseObject>*/{
86
+ function getPushStatus(pushStatusId, options = {}) {
92
87
  const pushOptions = {
93
88
  useMasterKey: true
94
89
  };
@@ -99,7 +94,7 @@ function getPushStatus(pushStatusId /*: string*/, options /*: FullOptions*/ = {}
99
94
  return query.get(pushStatusId, pushOptions);
100
95
  }
101
96
  const DefaultController = {
102
- async send(data /*: PushData*/, options /*:: ?: FullOptions*/) {
97
+ async send(data, options) {
103
98
  var _response$_headers;
104
99
  options.returnStatus = true;
105
100
  const response = await _CoreManager.default.getRESTController().request('POST', 'push', data, options);