parse 4.0.1 → 4.1.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 (251) hide show
  1. package/dist/parse.js +17995 -26193
  2. package/dist/parse.min.js +2 -2
  3. package/dist/parse.weapp.js +8739 -17728
  4. package/dist/parse.weapp.min.js +2 -2
  5. package/lib/browser/Analytics.js +2 -20
  6. package/lib/browser/AnonymousUtils.js +6 -35
  7. package/lib/browser/Cloud.js +12 -70
  8. package/lib/browser/CloudCode.js +0 -3
  9. package/lib/browser/CoreManager.js +46 -184
  10. package/lib/browser/CryptoController.js +2 -16
  11. package/lib/browser/EventEmitter.js +1 -1
  12. package/lib/browser/EventuallyQueue.js +277 -824
  13. package/lib/browser/FacebookUtils.js +6 -35
  14. package/lib/browser/IndexedDBStorageController.js +3 -14
  15. package/lib/browser/InstallationController.js +2 -13
  16. package/lib/browser/LiveQueryClient.js +87 -204
  17. package/lib/browser/LiveQuerySubscription.js +10 -39
  18. package/lib/browser/LocalDatastore.js +451 -1081
  19. package/lib/browser/LocalDatastoreController.js +145 -602
  20. package/lib/browser/LocalDatastoreController.react-native.js +137 -573
  21. package/lib/browser/LocalDatastoreUtils.js +2 -12
  22. package/lib/browser/ObjectStateMutations.js +18 -121
  23. package/lib/browser/OfflineQuery.js +42 -222
  24. package/lib/browser/Parse.js +12 -106
  25. package/lib/browser/ParseACL.js +33 -141
  26. package/lib/browser/ParseCLP.js +96 -314
  27. package/lib/browser/ParseConfig.js +18 -88
  28. package/lib/browser/ParseError.js +63 -90
  29. package/lib/browser/ParseFile.js +129 -685
  30. package/lib/browser/ParseGeoPoint.js +23 -82
  31. package/lib/browser/ParseHooks.js +1 -34
  32. package/lib/browser/ParseInstallation.js +4 -32
  33. package/lib/browser/ParseLiveQuery.js +96 -505
  34. package/lib/browser/ParseObject.js +628 -1840
  35. package/lib/browser/ParseOp.js +41 -287
  36. package/lib/browser/ParsePolygon.js +13 -63
  37. package/lib/browser/ParseQuery.js +404 -1505
  38. package/lib/browser/ParseRelation.js +12 -61
  39. package/lib/browser/ParseRole.js +13 -75
  40. package/lib/browser/ParseSchema.js +49 -201
  41. package/lib/browser/ParseSession.js +11 -69
  42. package/lib/browser/ParseUser.js +274 -1127
  43. package/lib/browser/Push.js +7 -43
  44. package/lib/browser/RESTController.js +18 -140
  45. package/lib/browser/SingleInstanceStateController.js +19 -137
  46. package/lib/browser/Socket.weapp.js +2 -12
  47. package/lib/browser/Storage.js +10 -73
  48. package/lib/browser/StorageController.browser.js +4 -17
  49. package/lib/browser/StorageController.default.js +4 -17
  50. package/lib/browser/StorageController.react-native.js +6 -33
  51. package/lib/browser/StorageController.weapp.js +5 -16
  52. package/lib/browser/TaskQueue.js +1 -22
  53. package/lib/browser/UniqueInstanceStateController.js +19 -142
  54. package/lib/browser/Xhr.weapp.js +0 -17
  55. package/lib/browser/arrayContainsObject.js +2 -16
  56. package/lib/browser/canBeSerialized.js +3 -33
  57. package/lib/browser/decode.js +3 -33
  58. package/lib/browser/encode.js +9 -70
  59. package/lib/browser/equals.js +2 -25
  60. package/lib/browser/escape.js +1 -8
  61. package/lib/browser/isRevocableSession.js +2 -11
  62. package/lib/browser/parseDate.js +2 -13
  63. package/lib/browser/promiseUtils.js +3 -21
  64. package/lib/browser/unique.js +3 -17
  65. package/lib/browser/unsavedChildren.js +6 -50
  66. package/lib/browser/uuid.js +3 -1
  67. package/lib/node/Analytics.js +1 -18
  68. package/lib/node/AnonymousUtils.js +5 -37
  69. package/lib/node/Cloud.js +10 -66
  70. package/lib/node/CloudCode.js +0 -3
  71. package/lib/node/CoreManager.js +47 -220
  72. package/lib/node/CryptoController.js +2 -16
  73. package/lib/node/EventEmitter.js +1 -1
  74. package/lib/node/EventuallyQueue.js +16 -123
  75. package/lib/node/FacebookUtils.js +5 -37
  76. package/lib/node/IndexedDBStorageController.js +3 -19
  77. package/lib/node/InstallationController.js +2 -15
  78. package/lib/node/LiveQueryClient.js +56 -136
  79. package/lib/node/LiveQuerySubscription.js +7 -16
  80. package/lib/node/LocalDatastore.js +19 -175
  81. package/lib/node/LocalDatastoreController.js +6 -38
  82. package/lib/node/LocalDatastoreController.react-native.js +6 -45
  83. package/lib/node/LocalDatastoreUtils.js +1 -6
  84. package/lib/node/ObjectStateMutations.js +13 -93
  85. package/lib/node/OfflineQuery.js +20 -152
  86. package/lib/node/Parse.js +11 -99
  87. package/lib/node/ParseACL.js +32 -150
  88. package/lib/node/ParseCLP.js +69 -262
  89. package/lib/node/ParseConfig.js +16 -84
  90. package/lib/node/ParseError.js +61 -65
  91. package/lib/node/ParseFile.js +50 -205
  92. package/lib/node/ParseGeoPoint.js +21 -82
  93. package/lib/node/ParseHooks.js +0 -35
  94. package/lib/node/ParseInstallation.js +1 -10
  95. package/lib/node/ParseLiveQuery.js +10 -36
  96. package/lib/node/ParseObject.js +193 -939
  97. package/lib/node/ParseOp.js +31 -255
  98. package/lib/node/ParsePolygon.js +12 -62
  99. package/lib/node/ParseQuery.js +170 -882
  100. package/lib/node/ParseRelation.js +11 -61
  101. package/lib/node/ParseRole.js +10 -57
  102. package/lib/node/ParseSchema.js +46 -222
  103. package/lib/node/ParseSession.js +8 -50
  104. package/lib/node/ParseUser.js +107 -576
  105. package/lib/node/Push.js +4 -37
  106. package/lib/node/RESTController.js +8 -110
  107. package/lib/node/SingleInstanceStateController.js +17 -130
  108. package/lib/node/Socket.weapp.js +2 -9
  109. package/lib/node/Storage.js +10 -83
  110. package/lib/node/StorageController.browser.js +4 -23
  111. package/lib/node/StorageController.default.js +5 -21
  112. package/lib/node/StorageController.react-native.js +6 -40
  113. package/lib/node/StorageController.weapp.js +6 -21
  114. package/lib/node/TaskQueue.js +1 -17
  115. package/lib/node/UniqueInstanceStateController.js +16 -133
  116. package/lib/node/Xhr.weapp.js +0 -15
  117. package/lib/node/arrayContainsObject.js +1 -12
  118. package/lib/node/canBeSerialized.js +2 -28
  119. package/lib/node/decode.js +1 -26
  120. package/lib/node/encode.js +3 -54
  121. package/lib/node/equals.js +0 -18
  122. package/lib/node/escape.js +1 -6
  123. package/lib/node/isRevocableSession.js +1 -5
  124. package/lib/node/parseDate.js +1 -7
  125. package/lib/node/promiseUtils.js +2 -14
  126. package/lib/node/unique.js +1 -11
  127. package/lib/node/unsavedChildren.js +2 -38
  128. package/lib/node/uuid.js +6 -1
  129. package/lib/react-native/Analytics.js +0 -9
  130. package/lib/react-native/AnonymousUtils.js +0 -10
  131. package/lib/react-native/Cloud.js +0 -26
  132. package/lib/react-native/CoreManager.js +1 -5
  133. package/lib/react-native/CryptoController.js +0 -2
  134. package/lib/react-native/EventEmitter.js +0 -2
  135. package/lib/react-native/EventuallyQueue.js +4 -52
  136. package/lib/react-native/FacebookUtils.js +0 -22
  137. package/lib/react-native/IndexedDBStorageController.js +0 -1
  138. package/lib/react-native/InstallationController.js +0 -6
  139. package/lib/react-native/LiveQueryClient.js +24 -101
  140. package/lib/react-native/LiveQuerySubscription.js +3 -27
  141. package/lib/react-native/LocalDatastore.js +6 -113
  142. package/lib/react-native/LocalDatastoreController.js +0 -21
  143. package/lib/react-native/LocalDatastoreController.react-native.js +4 -31
  144. package/lib/react-native/LocalDatastoreUtils.js +0 -1
  145. package/lib/react-native/ObjectStateMutations.js +0 -34
  146. package/lib/react-native/OfflineQuery.js +2 -137
  147. package/lib/react-native/Parse.js +0 -65
  148. package/lib/react-native/ParseACL.js +0 -44
  149. package/lib/react-native/ParseCLP.js +32 -96
  150. package/lib/react-native/ParseConfig.js +0 -42
  151. package/lib/react-native/ParseError.js +1 -21
  152. package/lib/react-native/ParseFile.js +4 -72
  153. package/lib/react-native/ParseGeoPoint.js +0 -17
  154. package/lib/react-native/ParseHooks.js +0 -30
  155. package/lib/react-native/ParseInstallation.js +1 -23
  156. package/lib/react-native/ParseLiveQuery.js +3 -25
  157. package/lib/react-native/ParseObject.js +4 -371
  158. package/lib/react-native/ParseOp.js +1 -138
  159. package/lib/react-native/ParsePolygon.js +0 -24
  160. package/lib/react-native/ParseQuery.js +6 -262
  161. package/lib/react-native/ParseRelation.js +0 -25
  162. package/lib/react-native/ParseRole.js +1 -36
  163. package/lib/react-native/ParseSchema.js +0 -51
  164. package/lib/react-native/ParseSession.js +1 -40
  165. package/lib/react-native/ParseUser.js +1 -224
  166. package/lib/react-native/Push.js +0 -16
  167. package/lib/react-native/RESTController.js +1 -70
  168. package/lib/react-native/SingleInstanceStateController.js +0 -44
  169. package/lib/react-native/Socket.weapp.js +2 -12
  170. package/lib/react-native/Storage.js +0 -24
  171. package/lib/react-native/StorageController.browser.js +0 -2
  172. package/lib/react-native/StorageController.default.js +0 -1
  173. package/lib/react-native/StorageController.react-native.js +0 -2
  174. package/lib/react-native/TaskQueue.js +0 -15
  175. package/lib/react-native/UniqueInstanceStateController.js +0 -47
  176. package/lib/react-native/Xhr.weapp.js +0 -16
  177. package/lib/react-native/arrayContainsObject.js +0 -5
  178. package/lib/react-native/canBeSerialized.js +0 -18
  179. package/lib/react-native/decode.js +0 -21
  180. package/lib/react-native/encode.js +0 -25
  181. package/lib/react-native/equals.js +0 -18
  182. package/lib/react-native/escape.js +0 -1
  183. package/lib/react-native/isRevocableSession.js +0 -1
  184. package/lib/react-native/parseDate.js +0 -3
  185. package/lib/react-native/promiseUtils.js +0 -13
  186. package/lib/react-native/unique.js +0 -4
  187. package/lib/react-native/unsavedChildren.js +0 -21
  188. package/lib/react-native/uuid.js +3 -1
  189. package/lib/weapp/Analytics.js +2 -20
  190. package/lib/weapp/AnonymousUtils.js +6 -35
  191. package/lib/weapp/Cloud.js +12 -70
  192. package/lib/weapp/CloudCode.js +0 -3
  193. package/lib/weapp/CoreManager.js +46 -184
  194. package/lib/weapp/CryptoController.js +2 -16
  195. package/lib/weapp/EventEmitter.js +1 -1
  196. package/lib/weapp/EventuallyQueue.js +277 -824
  197. package/lib/weapp/FacebookUtils.js +6 -35
  198. package/lib/weapp/IndexedDBStorageController.js +3 -14
  199. package/lib/weapp/InstallationController.js +2 -13
  200. package/lib/weapp/LiveQueryClient.js +87 -204
  201. package/lib/weapp/LiveQuerySubscription.js +10 -39
  202. package/lib/weapp/LocalDatastore.js +451 -1081
  203. package/lib/weapp/LocalDatastoreController.js +145 -602
  204. package/lib/weapp/LocalDatastoreController.react-native.js +137 -573
  205. package/lib/weapp/LocalDatastoreUtils.js +2 -12
  206. package/lib/weapp/ObjectStateMutations.js +18 -121
  207. package/lib/weapp/OfflineQuery.js +42 -222
  208. package/lib/weapp/Parse.js +12 -106
  209. package/lib/weapp/ParseACL.js +33 -141
  210. package/lib/weapp/ParseCLP.js +96 -314
  211. package/lib/weapp/ParseConfig.js +18 -88
  212. package/lib/weapp/ParseError.js +63 -90
  213. package/lib/weapp/ParseFile.js +130 -686
  214. package/lib/weapp/ParseGeoPoint.js +23 -82
  215. package/lib/weapp/ParseHooks.js +1 -34
  216. package/lib/weapp/ParseInstallation.js +4 -32
  217. package/lib/weapp/ParseLiveQuery.js +96 -505
  218. package/lib/weapp/ParseObject.js +628 -1840
  219. package/lib/weapp/ParseOp.js +41 -287
  220. package/lib/weapp/ParsePolygon.js +13 -63
  221. package/lib/weapp/ParseQuery.js +404 -1505
  222. package/lib/weapp/ParseRelation.js +12 -61
  223. package/lib/weapp/ParseRole.js +13 -75
  224. package/lib/weapp/ParseSchema.js +49 -201
  225. package/lib/weapp/ParseSession.js +11 -69
  226. package/lib/weapp/ParseUser.js +274 -1127
  227. package/lib/weapp/Push.js +7 -43
  228. package/lib/weapp/RESTController.js +18 -140
  229. package/lib/weapp/SingleInstanceStateController.js +19 -137
  230. package/lib/weapp/Socket.weapp.js +2 -12
  231. package/lib/weapp/Storage.js +10 -73
  232. package/lib/weapp/StorageController.browser.js +4 -17
  233. package/lib/weapp/StorageController.default.js +4 -17
  234. package/lib/weapp/StorageController.react-native.js +6 -33
  235. package/lib/weapp/StorageController.weapp.js +5 -16
  236. package/lib/weapp/TaskQueue.js +1 -22
  237. package/lib/weapp/UniqueInstanceStateController.js +19 -142
  238. package/lib/weapp/Xhr.weapp.js +0 -17
  239. package/lib/weapp/arrayContainsObject.js +2 -16
  240. package/lib/weapp/canBeSerialized.js +3 -33
  241. package/lib/weapp/decode.js +3 -33
  242. package/lib/weapp/encode.js +9 -70
  243. package/lib/weapp/equals.js +2 -25
  244. package/lib/weapp/escape.js +1 -8
  245. package/lib/weapp/isRevocableSession.js +2 -11
  246. package/lib/weapp/parseDate.js +2 -13
  247. package/lib/weapp/promiseUtils.js +3 -21
  248. package/lib/weapp/unique.js +3 -17
  249. package/lib/weapp/unsavedChildren.js +6 -50
  250. package/lib/weapp/uuid.js +1 -6
  251. package/package.json +45 -43
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _ParseRole = _interopRequireDefault(require("./ParseRole"));
9
-
10
8
  var _ParseUser = _interopRequireDefault(require("./ParseUser"));
11
-
12
9
  function _interopRequireDefault(obj) {
13
10
  return obj && obj.__esModule ? obj : {
14
11
  default: obj
@@ -18,8 +15,8 @@ function _interopRequireDefault(obj) {
18
15
  * @flow
19
16
  */
20
17
 
21
-
22
18
  const PUBLIC_KEY = '*';
19
+
23
20
  /**
24
21
  * Creates a new ACL.
25
22
  * If no argument is given, the ACL has no permissions for anyone.
@@ -34,18 +31,13 @@ const PUBLIC_KEY = '*';
34
31
  *
35
32
  * @alias Parse.ACL
36
33
  */
37
-
38
34
  class ParseACL {
39
35
  /*:: permissionsById: ByIdMap;*/
40
-
41
36
  /**
42
37
  * @param {(Parse.User | object)} arg1 The user to initialize the ACL for
43
38
  */
44
- constructor(arg1
45
- /*: ParseUser | ByIdMap*/
46
- ) {
39
+ constructor(arg1 /*: ParseUser | ByIdMap*/) {
47
40
  this.permissionsById = {};
48
-
49
41
  if (arg1 && typeof arg1 === 'object') {
50
42
  if (arg1 instanceof _ParseUser.default) {
51
43
  this.setReadAccess(arg1, true);
@@ -54,18 +46,14 @@ class ParseACL {
54
46
  for (const userId in arg1) {
55
47
  const accessList = arg1[userId];
56
48
  this.permissionsById[userId] = {};
57
-
58
49
  for (const permission in accessList) {
59
50
  const allowed = accessList[permission];
60
-
61
51
  if (permission !== 'read' && permission !== 'write') {
62
52
  throw new TypeError('Tried to create an ACL with an invalid permission type.');
63
53
  }
64
-
65
54
  if (typeof allowed !== 'boolean') {
66
55
  throw new TypeError('Tried to create an ACL with an invalid permission value.');
67
56
  }
68
-
69
57
  this.permissionsById[userId][permission] = allowed;
70
58
  }
71
59
  }
@@ -74,94 +62,65 @@ class ParseACL {
74
62
  throw new TypeError('ParseACL constructed with a function. Did you forget ()?');
75
63
  }
76
64
  }
65
+
77
66
  /**
78
67
  * Returns a JSON-encoded version of the ACL.
79
68
  *
80
69
  * @returns {object}
81
70
  */
82
-
83
-
84
- toJSON()
85
- /*: ByIdMap*/
86
- {
71
+ toJSON() /*: ByIdMap*/{
87
72
  const permissions = {};
88
-
89
73
  for (const p in this.permissionsById) {
90
74
  permissions[p] = this.permissionsById[p];
91
75
  }
92
-
93
76
  return permissions;
94
77
  }
78
+
95
79
  /**
96
80
  * Returns whether this ACL is equal to another object
97
81
  *
98
82
  * @param {ParseACL} other The other object's ACL to compare to
99
83
  * @returns {boolean}
100
84
  */
101
-
102
-
103
- equals(other
104
- /*: ParseACL*/
105
- )
106
- /*: boolean*/
107
- {
85
+ equals(other /*: ParseACL*/) /*: boolean*/{
108
86
  if (!(other instanceof ParseACL)) {
109
87
  return false;
110
88
  }
111
-
112
89
  const users = Object.keys(this.permissionsById);
113
90
  const otherUsers = Object.keys(other.permissionsById);
114
-
115
91
  if (users.length !== otherUsers.length) {
116
92
  return false;
117
93
  }
118
-
119
94
  for (const u in this.permissionsById) {
120
95
  if (!other.permissionsById[u]) {
121
96
  return false;
122
97
  }
123
-
124
98
  if (this.permissionsById[u].read !== other.permissionsById[u].read) {
125
99
  return false;
126
100
  }
127
-
128
101
  if (this.permissionsById[u].write !== other.permissionsById[u].write) {
129
102
  return false;
130
103
  }
131
104
  }
132
-
133
105
  return true;
134
106
  }
135
-
136
- _setAccess(accessType
137
- /*: string*/
138
- , userId
139
- /*: ParseUser | ParseRole | string*/
140
- , allowed
141
- /*: boolean*/
142
- ) {
107
+ _setAccess(accessType /*: string*/, userId /*: ParseUser | ParseRole | string*/, allowed /*: boolean*/) {
143
108
  if (userId instanceof _ParseUser.default) {
144
109
  userId = userId.id;
145
110
  } else if (userId instanceof _ParseRole.default) {
146
111
  const name = userId.getName();
147
-
148
112
  if (!name) {
149
113
  throw new TypeError('Role must have a name');
150
114
  }
151
-
152
115
  userId = 'role:' + name;
153
116
  }
154
-
155
117
  if (typeof userId !== 'string') {
156
118
  throw new TypeError('userId must be a string.');
157
119
  }
158
-
159
120
  if (typeof allowed !== 'boolean') {
160
121
  throw new TypeError('allowed must be either true or false.');
161
122
  }
162
-
163
123
  let permissions = this.permissionsById[userId];
164
-
165
124
  if (!permissions) {
166
125
  if (!allowed) {
167
126
  // The user already doesn't have this permission, so no action is needed
@@ -171,64 +130,45 @@ class ParseACL {
171
130
  this.permissionsById[userId] = permissions;
172
131
  }
173
132
  }
174
-
175
133
  if (allowed) {
176
134
  this.permissionsById[userId][accessType] = true;
177
135
  } else {
178
136
  delete permissions[accessType];
179
-
180
137
  if (Object.keys(permissions).length === 0) {
181
138
  delete this.permissionsById[userId];
182
139
  }
183
140
  }
184
141
  }
185
-
186
- _getAccess(accessType
187
- /*: string*/
188
- , userId
189
- /*: ParseUser | ParseRole | string*/
190
- )
191
- /*: boolean*/
192
- {
142
+ _getAccess(accessType /*: string*/, userId /*: ParseUser | ParseRole | string*/) /*: boolean*/{
193
143
  if (userId instanceof _ParseUser.default) {
194
144
  userId = userId.id;
195
-
196
145
  if (!userId) {
197
146
  throw new Error('Cannot get access for a ParseUser without an ID');
198
147
  }
199
148
  } else if (userId instanceof _ParseRole.default) {
200
149
  const name = userId.getName();
201
-
202
150
  if (!name) {
203
151
  throw new TypeError('Role must have a name');
204
152
  }
205
-
206
153
  userId = 'role:' + name;
207
154
  }
208
-
209
155
  const permissions = this.permissionsById[userId];
210
-
211
156
  if (!permissions) {
212
157
  return false;
213
158
  }
214
-
215
159
  return !!permissions[accessType];
216
160
  }
161
+
217
162
  /**
218
163
  * Sets whether the given user is allowed to read this object.
219
164
  *
220
165
  * @param userId An instance of Parse.User or its objectId.
221
166
  * @param {boolean} allowed Whether that user should have read access.
222
167
  */
223
-
224
-
225
- setReadAccess(userId
226
- /*: ParseUser | ParseRole | string*/
227
- , allowed
228
- /*: boolean*/
229
- ) {
168
+ setReadAccess(userId /*: ParseUser | ParseRole | string*/, allowed /*: boolean*/) {
230
169
  this._setAccess('read', userId, allowed);
231
170
  }
171
+
232
172
  /**
233
173
  * Get whether the given user id is *explicitly* allowed to read this object.
234
174
  * Even if this returns false, the user may still be able to access it if
@@ -238,30 +178,20 @@ class ParseACL {
238
178
  * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
239
179
  * @returns {boolean}
240
180
  */
241
-
242
-
243
- getReadAccess(userId
244
- /*: ParseUser | ParseRole | string*/
245
- )
246
- /*: boolean*/
247
- {
181
+ getReadAccess(userId /*: ParseUser | ParseRole | string*/) /*: boolean*/{
248
182
  return this._getAccess('read', userId);
249
183
  }
184
+
250
185
  /**
251
186
  * Sets whether the given user id is allowed to write this object.
252
187
  *
253
188
  * @param userId An instance of Parse.User or its objectId, or a Parse.Role..
254
189
  * @param {boolean} allowed Whether that user should have write access.
255
190
  */
256
-
257
-
258
- setWriteAccess(userId
259
- /*: ParseUser | ParseRole | string*/
260
- , allowed
261
- /*: boolean*/
262
- ) {
191
+ setWriteAccess(userId /*: ParseUser | ParseRole | string*/, allowed /*: boolean*/) {
263
192
  this._setAccess('write', userId, allowed);
264
193
  }
194
+
265
195
  /**
266
196
  * Gets whether the given user id is *explicitly* allowed to write this object.
267
197
  * Even if this returns false, the user may still be able to write it if
@@ -271,63 +201,46 @@ class ParseACL {
271
201
  * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
272
202
  * @returns {boolean}
273
203
  */
274
-
275
-
276
- getWriteAccess(userId
277
- /*: ParseUser | ParseRole | string*/
278
- )
279
- /*: boolean*/
280
- {
204
+ getWriteAccess(userId /*: ParseUser | ParseRole | string*/) /*: boolean*/{
281
205
  return this._getAccess('write', userId);
282
206
  }
207
+
283
208
  /**
284
209
  * Sets whether the public is allowed to read this object.
285
210
  *
286
211
  * @param {boolean} allowed
287
212
  */
288
-
289
-
290
- setPublicReadAccess(allowed
291
- /*: boolean*/
292
- ) {
213
+ setPublicReadAccess(allowed /*: boolean*/) {
293
214
  this.setReadAccess(PUBLIC_KEY, allowed);
294
215
  }
216
+
295
217
  /**
296
218
  * Gets whether the public is allowed to read this object.
297
219
  *
298
220
  * @returns {boolean}
299
221
  */
300
-
301
-
302
- getPublicReadAccess()
303
- /*: boolean*/
304
- {
222
+ getPublicReadAccess() /*: boolean*/{
305
223
  return this.getReadAccess(PUBLIC_KEY);
306
224
  }
225
+
307
226
  /**
308
227
  * Sets whether the public is allowed to write this object.
309
228
  *
310
229
  * @param {boolean} allowed
311
230
  */
312
-
313
-
314
- setPublicWriteAccess(allowed
315
- /*: boolean*/
316
- ) {
231
+ setPublicWriteAccess(allowed /*: boolean*/) {
317
232
  this.setWriteAccess(PUBLIC_KEY, allowed);
318
233
  }
234
+
319
235
  /**
320
236
  * Gets whether the public is allowed to write this object.
321
237
  *
322
238
  * @returns {boolean}
323
239
  */
324
-
325
-
326
- getPublicWriteAccess()
327
- /*: boolean*/
328
- {
240
+ getPublicWriteAccess() /*: boolean*/{
329
241
  return this.getWriteAccess(PUBLIC_KEY);
330
242
  }
243
+
331
244
  /**
332
245
  * Gets whether users belonging to the given role are allowed
333
246
  * to read this object. Even if this returns false, the role may
@@ -337,24 +250,17 @@ class ParseACL {
337
250
  * @returns {boolean} true if the role has read access. false otherwise.
338
251
  * @throws {TypeError} If role is neither a Parse.Role nor a String.
339
252
  */
340
-
341
-
342
- getRoleReadAccess(role
343
- /*: ParseRole | string*/
344
- )
345
- /*: boolean*/
346
- {
253
+ getRoleReadAccess(role /*: ParseRole | string*/) /*: boolean*/{
347
254
  if (role instanceof _ParseRole.default) {
348
255
  // Normalize to the String name
349
256
  role = role.getName();
350
257
  }
351
-
352
258
  if (typeof role !== 'string') {
353
259
  throw new TypeError('role must be a ParseRole or a String');
354
260
  }
355
-
356
261
  return this.getReadAccess('role:' + role);
357
262
  }
263
+
358
264
  /**
359
265
  * Gets whether users belonging to the given role are allowed
360
266
  * to write this object. Even if this returns false, the role may
@@ -364,24 +270,17 @@ class ParseACL {
364
270
  * @returns {boolean} true if the role has write access. false otherwise.
365
271
  * @throws {TypeError} If role is neither a Parse.Role nor a String.
366
272
  */
367
-
368
-
369
- getRoleWriteAccess(role
370
- /*: ParseRole | string*/
371
- )
372
- /*: boolean*/
373
- {
273
+ getRoleWriteAccess(role /*: ParseRole | string*/) /*: boolean*/{
374
274
  if (role instanceof _ParseRole.default) {
375
275
  // Normalize to the String name
376
276
  role = role.getName();
377
277
  }
378
-
379
278
  if (typeof role !== 'string') {
380
279
  throw new TypeError('role must be a ParseRole or a String');
381
280
  }
382
-
383
281
  return this.getWriteAccess('role:' + role);
384
282
  }
283
+
385
284
  /**
386
285
  * Sets whether users belonging to the given role are allowed
387
286
  * to read this object.
@@ -390,24 +289,17 @@ class ParseACL {
390
289
  * @param {boolean} allowed Whether the given role can read this object.
391
290
  * @throws {TypeError} If role is neither a Parse.Role nor a String.
392
291
  */
393
-
394
-
395
- setRoleReadAccess(role
396
- /*: ParseRole | string*/
397
- , allowed
398
- /*: boolean*/
399
- ) {
292
+ setRoleReadAccess(role /*: ParseRole | string*/, allowed /*: boolean*/) {
400
293
  if (role instanceof _ParseRole.default) {
401
294
  // Normalize to the String name
402
295
  role = role.getName();
403
296
  }
404
-
405
297
  if (typeof role !== 'string') {
406
298
  throw new TypeError('role must be a ParseRole or a String');
407
299
  }
408
-
409
300
  this.setReadAccess('role:' + role, allowed);
410
301
  }
302
+
411
303
  /**
412
304
  * Sets whether users belonging to the given role are allowed
413
305
  * to write this object.
@@ -416,26 +308,16 @@ class ParseACL {
416
308
  * @param {boolean} allowed Whether the given role can write this object.
417
309
  * @throws {TypeError} If role is neither a Parse.Role nor a String.
418
310
  */
419
-
420
-
421
- setRoleWriteAccess(role
422
- /*: ParseRole | string*/
423
- , allowed
424
- /*: boolean*/
425
- ) {
311
+ setRoleWriteAccess(role /*: ParseRole | string*/, allowed /*: boolean*/) {
426
312
  if (role instanceof _ParseRole.default) {
427
313
  // Normalize to the String name
428
314
  role = role.getName();
429
315
  }
430
-
431
316
  if (typeof role !== 'string') {
432
317
  throw new TypeError('role must be a ParseRole or a String');
433
318
  }
434
-
435
319
  this.setWriteAccess('role:' + role, allowed);
436
320
  }
437
-
438
321
  }
439
-
440
322
  var _default = ParseACL;
441
323
  exports.default = _default;