parse 6.1.0-alpha.2 → 6.1.0-alpha.4

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 (186) hide show
  1. package/README.md +0 -8
  2. package/dist/parse.js +31 -49
  3. package/dist/parse.min.js +2 -2
  4. package/dist/parse.weapp.js +31 -49
  5. package/dist/parse.weapp.min.js +2 -2
  6. package/lib/browser/CoreManager.js +1 -2
  7. package/lib/browser/CryptoController.js +0 -1
  8. package/lib/browser/EventEmitter.js +0 -1
  9. package/lib/browser/EventuallyQueue.js +0 -1
  10. package/lib/browser/IndexedDBStorageController.js +0 -1
  11. package/lib/browser/InstallationController.js +0 -1
  12. package/lib/browser/LocalDatastore.js +0 -1
  13. package/lib/browser/LocalDatastoreController.default.js +0 -1
  14. package/lib/browser/LocalDatastoreController.js +0 -1
  15. package/lib/browser/LocalDatastoreController.react-native.js +0 -1
  16. package/lib/browser/OfflineQuery.js +0 -1
  17. package/lib/browser/ParseInstallation.js +0 -1
  18. package/lib/browser/ParseObject.js +2 -1
  19. package/lib/browser/ParseOp.js +1 -1
  20. package/lib/browser/ParseQuery.js +19 -17
  21. package/lib/browser/RESTController.js +4 -3
  22. package/lib/browser/Socket.weapp.js +0 -1
  23. package/lib/browser/Storage.js +0 -1
  24. package/lib/browser/StorageController.browser.js +0 -1
  25. package/lib/browser/StorageController.default.js +0 -1
  26. package/lib/browser/StorageController.js +0 -1
  27. package/lib/browser/StorageController.react-native.js +0 -1
  28. package/lib/browser/StorageController.weapp.js +0 -1
  29. package/lib/browser/TaskQueue.js +1 -1
  30. package/lib/browser/WebSocketController.js +0 -1
  31. package/lib/browser/Xhr.weapp.js +0 -1
  32. package/lib/browser/uuid.js +0 -1
  33. package/lib/node/CoreManager.js +1 -2
  34. package/lib/node/CryptoController.js +0 -1
  35. package/lib/node/EventEmitter.js +0 -1
  36. package/lib/node/EventuallyQueue.js +0 -1
  37. package/lib/node/IndexedDBStorageController.js +0 -1
  38. package/lib/node/InstallationController.js +0 -1
  39. package/lib/node/LocalDatastore.js +0 -1
  40. package/lib/node/LocalDatastoreController.default.js +0 -1
  41. package/lib/node/LocalDatastoreController.js +0 -1
  42. package/lib/node/LocalDatastoreController.react-native.js +0 -1
  43. package/lib/node/OfflineQuery.js +0 -1
  44. package/lib/node/ParseInstallation.js +0 -1
  45. package/lib/node/ParseObject.js +2 -1
  46. package/lib/node/ParseOp.js +1 -1
  47. package/lib/node/RESTController.js +0 -1
  48. package/lib/node/Socket.weapp.js +0 -1
  49. package/lib/node/Storage.js +0 -1
  50. package/lib/node/StorageController.browser.js +0 -1
  51. package/lib/node/StorageController.default.js +0 -1
  52. package/lib/node/StorageController.js +0 -1
  53. package/lib/node/StorageController.react-native.js +0 -1
  54. package/lib/node/StorageController.weapp.js +0 -1
  55. package/lib/node/TaskQueue.js +1 -1
  56. package/lib/node/WebSocketController.js +0 -1
  57. package/lib/node/Xhr.weapp.js +0 -1
  58. package/lib/node/uuid.js +0 -1
  59. package/lib/react-native/CoreManager.js +1 -2
  60. package/lib/react-native/CryptoController.js +0 -1
  61. package/lib/react-native/EventEmitter.js +0 -1
  62. package/lib/react-native/EventuallyQueue.js +0 -1
  63. package/lib/react-native/IndexedDBStorageController.js +0 -1
  64. package/lib/react-native/InstallationController.js +0 -1
  65. package/lib/react-native/LocalDatastore.js +0 -1
  66. package/lib/react-native/LocalDatastoreController.default.js +0 -1
  67. package/lib/react-native/LocalDatastoreController.js +0 -1
  68. package/lib/react-native/LocalDatastoreController.react-native.js +0 -1
  69. package/lib/react-native/ObjectStateMutations.js +13 -13
  70. package/lib/react-native/OfflineQuery.js +0 -1
  71. package/lib/react-native/ParseACL.js +7 -7
  72. package/lib/react-native/ParseCLP.js +15 -15
  73. package/lib/react-native/ParseInstallation.js +0 -1
  74. package/lib/react-native/ParseObject.js +9 -9
  75. package/lib/react-native/ParseUser.js +15 -15
  76. package/lib/react-native/RESTController.js +0 -1
  77. package/lib/react-native/Socket.weapp.js +0 -1
  78. package/lib/react-native/Storage.js +0 -1
  79. package/lib/react-native/StorageController.browser.js +0 -1
  80. package/lib/react-native/StorageController.default.js +0 -1
  81. package/lib/react-native/StorageController.js +0 -1
  82. package/lib/react-native/StorageController.react-native.js +0 -1
  83. package/lib/react-native/StorageController.weapp.js +0 -1
  84. package/lib/react-native/TaskQueue.js +0 -1
  85. package/lib/react-native/WebSocketController.js +0 -1
  86. package/lib/react-native/Xhr.weapp.js +0 -1
  87. package/lib/react-native/uuid.js +0 -1
  88. package/lib/weapp/CoreManager.js +1 -2
  89. package/lib/weapp/CryptoController.js +0 -1
  90. package/lib/weapp/EventEmitter.js +0 -1
  91. package/lib/weapp/EventuallyQueue.js +0 -1
  92. package/lib/weapp/IndexedDBStorageController.js +0 -1
  93. package/lib/weapp/InstallationController.js +0 -1
  94. package/lib/weapp/LocalDatastore.js +0 -1
  95. package/lib/weapp/LocalDatastoreController.default.js +0 -1
  96. package/lib/weapp/LocalDatastoreController.js +0 -1
  97. package/lib/weapp/LocalDatastoreController.react-native.js +0 -1
  98. package/lib/weapp/OfflineQuery.js +0 -1
  99. package/lib/weapp/ParseInstallation.js +0 -1
  100. package/lib/weapp/ParseObject.js +2 -1
  101. package/lib/weapp/ParseOp.js +1 -1
  102. package/lib/weapp/ParseQuery.js +19 -17
  103. package/lib/weapp/RESTController.js +4 -3
  104. package/lib/weapp/Socket.weapp.js +0 -1
  105. package/lib/weapp/Storage.js +0 -1
  106. package/lib/weapp/StorageController.browser.js +0 -1
  107. package/lib/weapp/StorageController.default.js +0 -1
  108. package/lib/weapp/StorageController.js +0 -1
  109. package/lib/weapp/StorageController.react-native.js +0 -1
  110. package/lib/weapp/StorageController.weapp.js +0 -1
  111. package/lib/weapp/TaskQueue.js +1 -1
  112. package/lib/weapp/WebSocketController.js +0 -1
  113. package/lib/weapp/Xhr.weapp.js +0 -1
  114. package/lib/weapp/uuid.js +0 -1
  115. package/package.json +14 -12
  116. package/types/Analytics.d.ts +40 -0
  117. package/types/AnonymousUtils.d.ts +84 -0
  118. package/types/Cloud.d.ts +65 -0
  119. package/types/CloudCode.d.ts +307 -0
  120. package/types/CoreManager.d.ts +319 -0
  121. package/types/CryptoController.d.ts +5 -0
  122. package/types/EventEmitter.d.ts +5 -0
  123. package/types/EventuallyQueue.d.ts +168 -0
  124. package/types/FacebookUtils.d.ts +107 -0
  125. package/types/IndexedDBStorageController.d.ts +2 -0
  126. package/types/InstallationController.d.ts +10 -0
  127. package/types/LiveQueryClient.d.ts +128 -0
  128. package/types/LiveQuerySubscription.d.ts +103 -0
  129. package/types/LocalDatastore.d.ts +56 -0
  130. package/types/LocalDatastoreController.d.ts +2 -0
  131. package/types/LocalDatastoreController.default.d.ts +9 -0
  132. package/types/LocalDatastoreController.react-native.d.ts +9 -0
  133. package/types/LocalDatastoreUtils.d.ts +5 -0
  134. package/types/ObjectStateMutations.d.ts +22 -0
  135. package/types/OfflineQuery.d.ts +20 -0
  136. package/types/Parse.d.ts +372 -0
  137. package/types/ParseACL.d.ts +137 -0
  138. package/types/ParseCLP.d.ts +289 -0
  139. package/types/ParseConfig.d.ts +69 -0
  140. package/types/ParseError.d.ts +476 -0
  141. package/types/ParseFile.d.ts +188 -0
  142. package/types/ParseGeoPoint.d.ts +104 -0
  143. package/types/ParseHooks.d.ts +27 -0
  144. package/types/ParseInstallation.d.ts +179 -0
  145. package/types/ParseLiveQuery.d.ts +48 -0
  146. package/types/ParseObject.d.ts +1070 -0
  147. package/types/ParseOp.d.ts +76 -0
  148. package/types/ParsePolygon.d.ts +69 -0
  149. package/types/ParseQuery.d.ts +953 -0
  150. package/types/ParseRelation.d.ts +56 -0
  151. package/types/ParseRole.d.ts +79 -0
  152. package/types/ParseSchema.d.ts +270 -0
  153. package/types/ParseSession.d.ts +45 -0
  154. package/types/ParseUser.d.ts +511 -0
  155. package/types/Push.d.ts +62 -0
  156. package/types/RESTController.d.ts +35 -0
  157. package/types/SingleInstanceStateController.d.ts +24 -0
  158. package/types/Socket.weapp.d.ts +10 -0
  159. package/types/Storage.d.ts +14 -0
  160. package/types/StorageController.browser.d.ts +9 -0
  161. package/types/StorageController.d.ts +2 -0
  162. package/types/StorageController.default.d.ts +9 -0
  163. package/types/StorageController.react-native.d.ts +11 -0
  164. package/types/StorageController.weapp.d.ts +9 -0
  165. package/types/TaskQueue.d.ts +11 -0
  166. package/types/UniqueInstanceStateController.d.ts +20 -0
  167. package/types/WebSocketController.d.ts +2 -0
  168. package/types/Xhr.weapp.d.ts +29 -0
  169. package/types/arrayContainsObject.d.ts +2 -0
  170. package/types/canBeSerialized.d.ts +2 -0
  171. package/types/decode.d.ts +1 -0
  172. package/types/encode.d.ts +1 -0
  173. package/types/equals.d.ts +1 -0
  174. package/types/escape.d.ts +1 -0
  175. package/types/eslint.config.mjs +30 -0
  176. package/types/index.d.ts +66 -0
  177. package/types/isRevocableSession.d.ts +1 -0
  178. package/types/node.d.ts +3 -0
  179. package/types/parseDate.d.ts +1 -0
  180. package/types/promiseUtils.d.ts +9 -0
  181. package/types/react-native.d.ts +3 -0
  182. package/types/tests.ts +2256 -0
  183. package/types/tsconfig.json +25 -0
  184. package/types/unique.d.ts +1 -0
  185. package/types/unsavedChildren.d.ts +11 -0
  186. package/types/uuid.d.ts +2 -0
@@ -0,0 +1,476 @@
1
+ import type ParseObject from './ParseObject';
2
+ /**
3
+ * Constructs a new Parse.Error object with the given code and message.
4
+ *
5
+ * Parse.CoreManager.set('PARSE_ERRORS', [{ code, message }]) can be use to override error messages.
6
+ *
7
+ * @alias Parse.Error
8
+ */
9
+ declare class ParseError extends Error {
10
+ code: number;
11
+ message: string;
12
+ object?: ParseObject;
13
+ errors?: Error[];
14
+ /**
15
+ * @param {number} code An error code constant from <code>Parse.Error</code>.
16
+ * @param {string} message A detailed description of the error.
17
+ */
18
+ constructor(code: number, message?: string);
19
+ toString(): string;
20
+ /**
21
+ * Error code indicating some error other than those enumerated here.
22
+ *
23
+ * @property {number} OTHER_CAUSE
24
+ * @static
25
+ */
26
+ static OTHER_CAUSE: number;
27
+ /**
28
+ * Error code indicating that something has gone wrong with the server.
29
+ *
30
+ * @property {number} INTERNAL_SERVER_ERROR
31
+ * @static
32
+ */
33
+ static INTERNAL_SERVER_ERROR: number;
34
+ /**
35
+ * Error code indicating the connection to the Parse servers failed.
36
+ *
37
+ * @property {number} CONNECTION_FAILED
38
+ * @static
39
+ */
40
+ static CONNECTION_FAILED: number;
41
+ /**
42
+ * Error code indicating the specified object doesn't exist.
43
+ *
44
+ * @property {number} OBJECT_NOT_FOUND
45
+ * @static
46
+ */
47
+ static OBJECT_NOT_FOUND: number;
48
+ /**
49
+ * Error code indicating you tried to query with a datatype that doesn't
50
+ * support it, like exact matching an array or object.
51
+ *
52
+ * @property {number} INVALID_QUERY
53
+ * @static
54
+ */
55
+ static INVALID_QUERY: number;
56
+ /**
57
+ * Error code indicating a missing or invalid classname. Classnames are
58
+ * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
59
+ * only valid characters.
60
+ *
61
+ * @property {number} INVALID_CLASS_NAME
62
+ * @static
63
+ */
64
+ static INVALID_CLASS_NAME: number;
65
+ /**
66
+ * Error code indicating an unspecified object id.
67
+ *
68
+ * @property {number} MISSING_OBJECT_ID
69
+ * @static
70
+ */
71
+ static MISSING_OBJECT_ID: number;
72
+ /**
73
+ * Error code indicating an invalid key name. Keys are case-sensitive. They
74
+ * must start with a letter, and a-zA-Z0-9_ are the only valid characters.
75
+ *
76
+ * @property {number} INVALID_KEY_NAME
77
+ * @static
78
+ */
79
+ static INVALID_KEY_NAME: number;
80
+ /**
81
+ * Error code indicating a malformed pointer. You should not see this unless
82
+ * you have been mucking about changing internal Parse code.
83
+ *
84
+ * @property {number} INVALID_POINTER
85
+ * @static
86
+ */
87
+ static INVALID_POINTER: number;
88
+ /**
89
+ * Error code indicating that badly formed JSON was received upstream. This
90
+ * either indicates you have done something unusual with modifying how
91
+ * things encode to JSON, or the network is failing badly.
92
+ *
93
+ * @property {number} INVALID_JSON
94
+ * @static
95
+ */
96
+ static INVALID_JSON: number;
97
+ /**
98
+ * Error code indicating that the feature you tried to access is only
99
+ * available internally for testing purposes.
100
+ *
101
+ * @property {number} COMMAND_UNAVAILABLE
102
+ * @static
103
+ */
104
+ static COMMAND_UNAVAILABLE: number;
105
+ /**
106
+ * You must call Parse.initialize before using the Parse library.
107
+ *
108
+ * @property {number} NOT_INITIALIZED
109
+ * @static
110
+ */
111
+ static NOT_INITIALIZED: number;
112
+ /**
113
+ * Error code indicating that a field was set to an inconsistent type.
114
+ *
115
+ * @property {number} INCORRECT_TYPE
116
+ * @static
117
+ */
118
+ static INCORRECT_TYPE: number;
119
+ /**
120
+ * Error code indicating an invalid channel name. A channel name is either
121
+ * an empty string (the broadcast channel) or contains only a-zA-Z0-9_
122
+ * characters and starts with a letter.
123
+ *
124
+ * @property {number} INVALID_CHANNEL_NAME
125
+ * @static
126
+ */
127
+ static INVALID_CHANNEL_NAME: number;
128
+ /**
129
+ * Error code indicating that push is misconfigured.
130
+ *
131
+ * @property {number} PUSH_MISCONFIGURED
132
+ * @static
133
+ */
134
+ static PUSH_MISCONFIGURED: number;
135
+ /**
136
+ * Error code indicating that the object is too large.
137
+ *
138
+ * @property {number} OBJECT_TOO_LARGE
139
+ * @static
140
+ */
141
+ static OBJECT_TOO_LARGE: number;
142
+ /**
143
+ * Error code indicating that the operation isn't allowed for clients.
144
+ *
145
+ * @property {number} OPERATION_FORBIDDEN
146
+ * @static
147
+ */
148
+ static OPERATION_FORBIDDEN: number;
149
+ /**
150
+ * Error code indicating the result was not found in the cache.
151
+ *
152
+ * @property {number} CACHE_MISS
153
+ * @static
154
+ */
155
+ static CACHE_MISS: number;
156
+ /**
157
+ * Error code indicating that an invalid key was used in a nested
158
+ * JSONObject.
159
+ *
160
+ * @property {number} INVALID_NESTED_KEY
161
+ * @static
162
+ */
163
+ static INVALID_NESTED_KEY: number;
164
+ /**
165
+ * Error code indicating that an invalid filename was used for ParseFile.
166
+ * A valid file name contains only a-zA-Z0-9_. characters and is between 1
167
+ * and 128 characters.
168
+ *
169
+ * @property {number} INVALID_FILE_NAME
170
+ * @static
171
+ */
172
+ static INVALID_FILE_NAME: number;
173
+ /**
174
+ * Error code indicating an invalid ACL was provided.
175
+ *
176
+ * @property {number} INVALID_ACL
177
+ * @static
178
+ */
179
+ static INVALID_ACL: number;
180
+ /**
181
+ * Error code indicating that the request timed out on the server. Typically
182
+ * this indicates that the request is too expensive to run.
183
+ *
184
+ * @property {number} TIMEOUT
185
+ * @static
186
+ */
187
+ static TIMEOUT: number;
188
+ /**
189
+ * Error code indicating that the email address was invalid.
190
+ *
191
+ * @property {number} INVALID_EMAIL_ADDRESS
192
+ * @static
193
+ */
194
+ static INVALID_EMAIL_ADDRESS: number;
195
+ /**
196
+ * Error code indicating a missing content type.
197
+ *
198
+ * @property {number} MISSING_CONTENT_TYPE
199
+ * @static
200
+ */
201
+ static MISSING_CONTENT_TYPE: number;
202
+ /**
203
+ * Error code indicating a missing content length.
204
+ *
205
+ * @property {number} MISSING_CONTENT_LENGTH
206
+ * @static
207
+ */
208
+ static MISSING_CONTENT_LENGTH: number;
209
+ /**
210
+ * Error code indicating an invalid content length.
211
+ *
212
+ * @property {number} INVALID_CONTENT_LENGTH
213
+ * @static
214
+ */
215
+ static INVALID_CONTENT_LENGTH: number;
216
+ /**
217
+ * Error code indicating a file that was too large.
218
+ *
219
+ * @property {number} FILE_TOO_LARGE
220
+ * @static
221
+ */
222
+ static FILE_TOO_LARGE: number;
223
+ /**
224
+ * Error code indicating an error saving a file.
225
+ *
226
+ * @property {number} FILE_SAVE_ERROR
227
+ * @static
228
+ */
229
+ static FILE_SAVE_ERROR: number;
230
+ /**
231
+ * Error code indicating that a unique field was given a value that is
232
+ * already taken.
233
+ *
234
+ * @property {number} DUPLICATE_VALUE
235
+ * @static
236
+ */
237
+ static DUPLICATE_VALUE: number;
238
+ /**
239
+ * Error code indicating that a role's name is invalid.
240
+ *
241
+ * @property {number} INVALID_ROLE_NAME
242
+ * @static
243
+ */
244
+ static INVALID_ROLE_NAME: number;
245
+ /**
246
+ * Error code indicating that an application quota was exceeded. Upgrade to
247
+ * resolve.
248
+ *
249
+ * @property {number} EXCEEDED_QUOTA
250
+ * @static
251
+ */
252
+ static EXCEEDED_QUOTA: number;
253
+ /**
254
+ * Error code indicating that a Cloud Code script failed.
255
+ *
256
+ * @property {number} SCRIPT_FAILED
257
+ * @static
258
+ */
259
+ static SCRIPT_FAILED: number;
260
+ /**
261
+ * Error code indicating that a Cloud Code validation failed.
262
+ *
263
+ * @property {number} VALIDATION_ERROR
264
+ * @static
265
+ */
266
+ static VALIDATION_ERROR: number;
267
+ /**
268
+ * Error code indicating that invalid image data was provided.
269
+ *
270
+ * @property {number} INVALID_IMAGE_DATA
271
+ * @static
272
+ */
273
+ static INVALID_IMAGE_DATA: number;
274
+ /**
275
+ * Error code indicating an unsaved file.
276
+ *
277
+ * @property {number} UNSAVED_FILE_ERROR
278
+ * @static
279
+ */
280
+ static UNSAVED_FILE_ERROR: number;
281
+ /**
282
+ * Error code indicating an invalid push time.
283
+ *
284
+ * @property {number} INVALID_PUSH_TIME_ERROR
285
+ * @static
286
+ */
287
+ static INVALID_PUSH_TIME_ERROR: number;
288
+ /**
289
+ * Error code indicating an error deleting a file.
290
+ *
291
+ * @property {number} FILE_DELETE_ERROR
292
+ * @static
293
+ */
294
+ static FILE_DELETE_ERROR: number;
295
+ /**
296
+ * Error code indicating an error deleting an unnamed file.
297
+ *
298
+ * @property {number} FILE_DELETE_UNNAMED_ERROR
299
+ * @static
300
+ */
301
+ static FILE_DELETE_UNNAMED_ERROR: number;
302
+ /**
303
+ * Error code indicating that the application has exceeded its request
304
+ * limit.
305
+ *
306
+ * @property {number} REQUEST_LIMIT_EXCEEDED
307
+ * @static
308
+ */
309
+ static REQUEST_LIMIT_EXCEEDED: number;
310
+ /**
311
+ * Error code indicating that the request was a duplicate and has been discarded due to
312
+ * idempotency rules.
313
+ *
314
+ * @property {number} DUPLICATE_REQUEST
315
+ * @static
316
+ */
317
+ static DUPLICATE_REQUEST: number;
318
+ /**
319
+ * Error code indicating an invalid event name.
320
+ *
321
+ * @property {number} INVALID_EVENT_NAME
322
+ * @static
323
+ */
324
+ static INVALID_EVENT_NAME: number;
325
+ /**
326
+ * Error code indicating that a field had an invalid value.
327
+ *
328
+ * @property {number} INVALID_VALUE
329
+ * @static
330
+ */
331
+ static INVALID_VALUE: number;
332
+ /**
333
+ * Error code indicating that the username is missing or empty.
334
+ *
335
+ * @property {number} USERNAME_MISSING
336
+ * @static
337
+ */
338
+ static USERNAME_MISSING: number;
339
+ /**
340
+ * Error code indicating that the password is missing or empty.
341
+ *
342
+ * @property {number} PASSWORD_MISSING
343
+ * @static
344
+ */
345
+ static PASSWORD_MISSING: number;
346
+ /**
347
+ * Error code indicating that the username has already been taken.
348
+ *
349
+ * @property {number} USERNAME_TAKEN
350
+ * @static
351
+ */
352
+ static USERNAME_TAKEN: number;
353
+ /**
354
+ * Error code indicating that the email has already been taken.
355
+ *
356
+ * @property {number} EMAIL_TAKEN
357
+ * @static
358
+ */
359
+ static EMAIL_TAKEN: number;
360
+ /**
361
+ * Error code indicating that the email is missing, but must be specified.
362
+ *
363
+ * @property {number} EMAIL_MISSING
364
+ * @static
365
+ */
366
+ static EMAIL_MISSING: number;
367
+ /**
368
+ * Error code indicating that a user with the specified email was not found.
369
+ *
370
+ * @property {number} EMAIL_NOT_FOUND
371
+ * @static
372
+ */
373
+ static EMAIL_NOT_FOUND: number;
374
+ /**
375
+ * Error code indicating that a user object without a valid session could
376
+ * not be altered.
377
+ *
378
+ * @property {number} SESSION_MISSING
379
+ * @static
380
+ */
381
+ static SESSION_MISSING: number;
382
+ /**
383
+ * Error code indicating that a user can only be created through signup.
384
+ *
385
+ * @property {number} MUST_CREATE_USER_THROUGH_SIGNUP
386
+ * @static
387
+ */
388
+ static MUST_CREATE_USER_THROUGH_SIGNUP: number;
389
+ /**
390
+ * Error code indicating that an an account being linked is already linked
391
+ * to another user.
392
+ *
393
+ * @property {number} ACCOUNT_ALREADY_LINKED
394
+ * @static
395
+ */
396
+ static ACCOUNT_ALREADY_LINKED: number;
397
+ /**
398
+ * Error code indicating that the current session token is invalid.
399
+ *
400
+ * @property {number} INVALID_SESSION_TOKEN
401
+ * @static
402
+ */
403
+ static INVALID_SESSION_TOKEN: number;
404
+ /**
405
+ * Error code indicating an error enabling or verifying MFA
406
+ *
407
+ * @property {number} MFA_ERROR
408
+ * @static
409
+ */
410
+ static MFA_ERROR: number;
411
+ /**
412
+ * Error code indicating that a valid MFA token must be provided
413
+ *
414
+ * @property {number} MFA_TOKEN_REQUIRED
415
+ * @static
416
+ */
417
+ static MFA_TOKEN_REQUIRED: number;
418
+ /**
419
+ * Error code indicating that a user cannot be linked to an account because
420
+ * that account's id could not be found.
421
+ *
422
+ * @property {number} LINKED_ID_MISSING
423
+ * @static
424
+ */
425
+ static LINKED_ID_MISSING: number;
426
+ /**
427
+ * Error code indicating that a user with a linked (e.g. Facebook) account
428
+ * has an invalid session.
429
+ *
430
+ * @property {number} INVALID_LINKED_SESSION
431
+ * @static
432
+ */
433
+ static INVALID_LINKED_SESSION: number;
434
+ /**
435
+ * Error code indicating that a service being linked (e.g. Facebook or
436
+ * Twitter) is unsupported.
437
+ *
438
+ * @property {number} UNSUPPORTED_SERVICE
439
+ * @static
440
+ */
441
+ static UNSUPPORTED_SERVICE: number;
442
+ /**
443
+ * Error code indicating an invalid operation occured on schema
444
+ *
445
+ * @property {number} INVALID_SCHEMA_OPERATION
446
+ * @static
447
+ */
448
+ static INVALID_SCHEMA_OPERATION: number;
449
+ /**
450
+ * Error code indicating that there were multiple errors. Aggregate errors
451
+ * have an "errors" property, which is an array of error objects with more
452
+ * detail about each error that occurred.
453
+ *
454
+ * @property {number} AGGREGATE_ERROR
455
+ * @static
456
+ */
457
+ static AGGREGATE_ERROR: number;
458
+ /**
459
+ * Error code indicating the client was unable to read an input file.
460
+ *
461
+ * @property {number} FILE_READ_ERROR
462
+ * @static
463
+ */
464
+ static FILE_READ_ERROR: number;
465
+ /**
466
+ * Error code indicating a real error code is unavailable because
467
+ * we had to use an XDomainRequest object to allow CORS requests in
468
+ * Internet Explorer, which strips the body from HTTP responses that have
469
+ * a non-2XX status code.
470
+ *
471
+ * @property {number} X_DOMAIN_REQUEST
472
+ * @static
473
+ */
474
+ static X_DOMAIN_REQUEST: number;
475
+ }
476
+ export default ParseError;
@@ -0,0 +1,188 @@
1
+ import type { FullOptions } from './RESTController';
2
+ interface Base64 {
3
+ base64: string;
4
+ }
5
+ interface Uri {
6
+ uri: string;
7
+ }
8
+ type FileData = number[] | Base64 | Blob | Uri;
9
+ export type FileSaveOptions = FullOptions & {
10
+ metadata?: Record<string, any>;
11
+ tags?: Record<string, any>;
12
+ };
13
+ export type FileSource = {
14
+ format: 'file';
15
+ file: Blob;
16
+ type: string | undefined;
17
+ } | {
18
+ format: 'base64';
19
+ base64: string;
20
+ type: string | undefined;
21
+ } | {
22
+ format: 'uri';
23
+ uri: string;
24
+ type: string | undefined;
25
+ };
26
+ /**
27
+ * A Parse.File is a local representation of a file that is saved to the Parse
28
+ * cloud.
29
+ *
30
+ * @alias Parse.File
31
+ */
32
+ declare class ParseFile {
33
+ _name: string;
34
+ _url?: string;
35
+ _source: FileSource;
36
+ _previousSave?: Promise<ParseFile>;
37
+ _data?: string;
38
+ _requestTask?: any;
39
+ _metadata?: Record<string, any>;
40
+ _tags?: Record<string, any>;
41
+ /**
42
+ * @param name {String} The file's name. This will be prefixed by a unique
43
+ * value once the file has finished saving. The file name must begin with
44
+ * an alphanumeric character, and consist of alphanumeric characters,
45
+ * periods, spaces, underscores, or dashes.
46
+ * @param data {Array} The data for the file, as either:
47
+ * 1. an Array of byte value Numbers, or
48
+ * 2. an Object like { base64: "..." } with a base64-encoded String.
49
+ * 3. an Object like { uri: "..." } with a uri String.
50
+ * 4. a File object selected with a file upload control. (3) only works
51
+ * in Firefox 3.6+, Safari 6.0.2+, Chrome 7+, and IE 10+.
52
+ * For example:
53
+ * <pre>
54
+ * var fileUploadControl = $("#profilePhotoFileUpload")[0];
55
+ * if (fileUploadControl.files.length > 0) {
56
+ * var file = fileUploadControl.files[0];
57
+ * var name = "photo.jpg";
58
+ * var parseFile = new Parse.File(name, file);
59
+ * parseFile.save().then(function() {
60
+ * // The file has been saved to Parse.
61
+ * }, function(error) {
62
+ * // The file either could not be read, or could not be saved to Parse.
63
+ * });
64
+ * }</pre>
65
+ * @param type {String} Optional Content-Type header to use for the file. If
66
+ * this is omitted, the content type will be inferred from the name's
67
+ * extension.
68
+ * @param metadata {object} Optional key value pairs to be stored with file object
69
+ * @param tags {object} Optional key value pairs to be stored with file object
70
+ */
71
+ constructor(name: string, data?: FileData, type?: string, metadata?: object, tags?: object);
72
+ /**
73
+ * Return the data for the file, downloading it if not already present.
74
+ * Data is present if initialized with Byte Array, Base64 or Saved with Uri.
75
+ * Data is cleared if saved with File object selected with a file upload control
76
+ *
77
+ * @returns {Promise} Promise that is resolve with base64 data
78
+ */
79
+ getData(): Promise<string>;
80
+ /**
81
+ * Gets the name of the file. Before save is called, this is the filename
82
+ * given by the user. After save is called, that name gets prefixed with a
83
+ * unique identifier.
84
+ *
85
+ * @returns {string}
86
+ */
87
+ name(): string;
88
+ /**
89
+ * Gets the url of the file. It is only available after you save the file or
90
+ * after you get the file from a Parse.Object.
91
+ *
92
+ * @param {object} options An object to specify url options
93
+ * @param {boolean} [options.forceSecure] force the url to be secure
94
+ * @returns {string | undefined}
95
+ */
96
+ url(options?: {
97
+ forceSecure?: boolean;
98
+ }): string | undefined;
99
+ /**
100
+ * Gets the metadata of the file.
101
+ *
102
+ * @returns {object}
103
+ */
104
+ metadata(): Record<string, any>;
105
+ /**
106
+ * Gets the tags of the file.
107
+ *
108
+ * @returns {object}
109
+ */
110
+ tags(): Record<string, any>;
111
+ /**
112
+ * Saves the file to the Parse cloud.
113
+ *
114
+ * @param {object} options
115
+ * Valid options are:<ul>
116
+ * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
117
+ * be used for this request.
118
+ * <li>sessionToken: A valid session token, used for making a request on
119
+ * behalf of a specific user.
120
+ * <li>progress: In Browser only, callback for upload progress. For example:
121
+ * <pre>
122
+ * let parseFile = new Parse.File(name, file);
123
+ * parseFile.save({
124
+ * progress: (progressValue, loaded, total, { type }) => {
125
+ * if (type === "upload" && progressValue !== null) {
126
+ * // Update the UI using progressValue
127
+ * }
128
+ * }
129
+ * });
130
+ * </pre>
131
+ * </ul>
132
+ * @returns {Promise | undefined} Promise that is resolved when the save finishes.
133
+ */
134
+ save(options?: FileSaveOptions & {
135
+ requestTask?: any;
136
+ }): Promise<ParseFile> | undefined;
137
+ /**
138
+ * Aborts the request if it has already been sent.
139
+ */
140
+ cancel(): void;
141
+ /**
142
+ * Deletes the file from the Parse cloud.
143
+ * In Cloud Code and Node only with Master Key.
144
+ *
145
+ * @param {object} options
146
+ * Valid options are:<ul>
147
+ * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
148
+ * be used for this request.
149
+ * <pre>
150
+ * @returns {Promise} Promise that is resolved when the delete finishes.
151
+ */
152
+ destroy(options?: FullOptions): Promise<this>;
153
+ toJSON(): {
154
+ __type: 'File';
155
+ name?: string;
156
+ url?: string;
157
+ };
158
+ equals(other: any): boolean;
159
+ /**
160
+ * Sets metadata to be saved with file object. Overwrites existing metadata
161
+ *
162
+ * @param {object} metadata Key value pairs to be stored with file object
163
+ */
164
+ setMetadata(metadata: Record<string, any>): void;
165
+ /**
166
+ * Sets metadata to be saved with file object. Adds to existing metadata.
167
+ *
168
+ * @param {string} key key to store the metadata
169
+ * @param {*} value metadata
170
+ */
171
+ addMetadata(key: string, value: any): void;
172
+ /**
173
+ * Sets tags to be saved with file object. Overwrites existing tags
174
+ *
175
+ * @param {object} tags Key value pairs to be stored with file object
176
+ */
177
+ setTags(tags: Record<string, any>): void;
178
+ /**
179
+ * Sets tags to be saved with file object. Adds to existing tags.
180
+ *
181
+ * @param {string} key key to store tags
182
+ * @param {*} value tag
183
+ */
184
+ addTag(key: string, value: string): void;
185
+ static fromJSON(obj: any): ParseFile;
186
+ static encodeBase64(bytes: number[] | Uint8Array): string;
187
+ }
188
+ export default ParseFile;