parse 6.1.0-alpha.2 → 6.1.0

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 (174) hide show
  1. package/README.md +0 -8
  2. package/dist/parse.js +27 -47
  3. package/dist/parse.min.js +2 -2
  4. package/dist/parse.weapp.js +27 -47
  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/ParseQuery.js +19 -17
  19. package/lib/browser/RESTController.js +4 -3
  20. package/lib/browser/Socket.weapp.js +0 -1
  21. package/lib/browser/Storage.js +0 -1
  22. package/lib/browser/StorageController.browser.js +0 -1
  23. package/lib/browser/StorageController.default.js +0 -1
  24. package/lib/browser/StorageController.js +0 -1
  25. package/lib/browser/StorageController.react-native.js +0 -1
  26. package/lib/browser/StorageController.weapp.js +0 -1
  27. package/lib/browser/TaskQueue.js +0 -1
  28. package/lib/browser/WebSocketController.js +0 -1
  29. package/lib/browser/Xhr.weapp.js +0 -1
  30. package/lib/browser/uuid.js +0 -1
  31. package/lib/node/CoreManager.js +1 -2
  32. package/lib/node/CryptoController.js +0 -1
  33. package/lib/node/EventEmitter.js +0 -1
  34. package/lib/node/EventuallyQueue.js +0 -1
  35. package/lib/node/IndexedDBStorageController.js +0 -1
  36. package/lib/node/InstallationController.js +0 -1
  37. package/lib/node/LocalDatastore.js +0 -1
  38. package/lib/node/LocalDatastoreController.default.js +0 -1
  39. package/lib/node/LocalDatastoreController.js +0 -1
  40. package/lib/node/LocalDatastoreController.react-native.js +0 -1
  41. package/lib/node/OfflineQuery.js +0 -1
  42. package/lib/node/ParseInstallation.js +0 -1
  43. package/lib/node/RESTController.js +0 -1
  44. package/lib/node/Socket.weapp.js +0 -1
  45. package/lib/node/Storage.js +0 -1
  46. package/lib/node/StorageController.browser.js +0 -1
  47. package/lib/node/StorageController.default.js +0 -1
  48. package/lib/node/StorageController.js +0 -1
  49. package/lib/node/StorageController.react-native.js +0 -1
  50. package/lib/node/StorageController.weapp.js +0 -1
  51. package/lib/node/TaskQueue.js +0 -1
  52. package/lib/node/WebSocketController.js +0 -1
  53. package/lib/node/Xhr.weapp.js +0 -1
  54. package/lib/node/uuid.js +0 -1
  55. package/lib/react-native/CoreManager.js +1 -2
  56. package/lib/react-native/CryptoController.js +0 -1
  57. package/lib/react-native/EventEmitter.js +0 -1
  58. package/lib/react-native/EventuallyQueue.js +0 -1
  59. package/lib/react-native/IndexedDBStorageController.js +0 -1
  60. package/lib/react-native/InstallationController.js +0 -1
  61. package/lib/react-native/LocalDatastore.js +0 -1
  62. package/lib/react-native/LocalDatastoreController.default.js +0 -1
  63. package/lib/react-native/LocalDatastoreController.js +0 -1
  64. package/lib/react-native/LocalDatastoreController.react-native.js +0 -1
  65. package/lib/react-native/OfflineQuery.js +0 -1
  66. package/lib/react-native/ParseInstallation.js +0 -1
  67. package/lib/react-native/RESTController.js +0 -1
  68. package/lib/react-native/Socket.weapp.js +0 -1
  69. package/lib/react-native/Storage.js +0 -1
  70. package/lib/react-native/StorageController.browser.js +0 -1
  71. package/lib/react-native/StorageController.default.js +0 -1
  72. package/lib/react-native/StorageController.js +0 -1
  73. package/lib/react-native/StorageController.react-native.js +0 -1
  74. package/lib/react-native/StorageController.weapp.js +0 -1
  75. package/lib/react-native/TaskQueue.js +0 -1
  76. package/lib/react-native/WebSocketController.js +0 -1
  77. package/lib/react-native/Xhr.weapp.js +0 -1
  78. package/lib/react-native/uuid.js +0 -1
  79. package/lib/weapp/CoreManager.js +1 -2
  80. package/lib/weapp/CryptoController.js +0 -1
  81. package/lib/weapp/EventEmitter.js +0 -1
  82. package/lib/weapp/EventuallyQueue.js +0 -1
  83. package/lib/weapp/IndexedDBStorageController.js +0 -1
  84. package/lib/weapp/InstallationController.js +0 -1
  85. package/lib/weapp/LocalDatastore.js +0 -1
  86. package/lib/weapp/LocalDatastoreController.default.js +0 -1
  87. package/lib/weapp/LocalDatastoreController.js +0 -1
  88. package/lib/weapp/LocalDatastoreController.react-native.js +0 -1
  89. package/lib/weapp/OfflineQuery.js +0 -1
  90. package/lib/weapp/ParseInstallation.js +0 -1
  91. package/lib/weapp/ParseQuery.js +19 -17
  92. package/lib/weapp/RESTController.js +4 -3
  93. package/lib/weapp/Socket.weapp.js +0 -1
  94. package/lib/weapp/Storage.js +0 -1
  95. package/lib/weapp/StorageController.browser.js +0 -1
  96. package/lib/weapp/StorageController.default.js +0 -1
  97. package/lib/weapp/StorageController.js +0 -1
  98. package/lib/weapp/StorageController.react-native.js +0 -1
  99. package/lib/weapp/StorageController.weapp.js +0 -1
  100. package/lib/weapp/TaskQueue.js +0 -1
  101. package/lib/weapp/WebSocketController.js +0 -1
  102. package/lib/weapp/Xhr.weapp.js +0 -1
  103. package/lib/weapp/uuid.js +0 -1
  104. package/package.json +11 -9
  105. package/types/Analytics.d.ts +42 -0
  106. package/types/AnonymousUtils.d.ts +84 -0
  107. package/types/Cloud.d.ts +65 -0
  108. package/types/CloudCode.d.ts +307 -0
  109. package/types/CoreManager.d.ts +325 -0
  110. package/types/CryptoController.d.ts +5 -0
  111. package/types/EventEmitter.d.ts +5 -0
  112. package/types/EventuallyQueue.d.ts +168 -0
  113. package/types/FacebookUtils.d.ts +107 -0
  114. package/types/IndexedDBStorageController.d.ts +2 -0
  115. package/types/InstallationController.d.ts +10 -0
  116. package/types/LiveQueryClient.d.ts +128 -0
  117. package/types/LiveQuerySubscription.d.ts +103 -0
  118. package/types/LocalDatastore.d.ts +56 -0
  119. package/types/LocalDatastoreController.d.ts +2 -0
  120. package/types/LocalDatastoreController.default.d.ts +9 -0
  121. package/types/LocalDatastoreController.react-native.d.ts +9 -0
  122. package/types/LocalDatastoreUtils.d.ts +5 -0
  123. package/types/ObjectStateMutations.d.ts +28 -0
  124. package/types/OfflineQuery.d.ts +20 -0
  125. package/types/Parse.d.ts +633 -0
  126. package/types/ParseACL.d.ts +141 -0
  127. package/types/ParseCLP.d.ts +293 -0
  128. package/types/ParseConfig.d.ts +77 -0
  129. package/types/ParseError.d.ts +476 -0
  130. package/types/ParseFile.d.ts +192 -0
  131. package/types/ParseGeoPoint.d.ts +104 -0
  132. package/types/ParseHooks.d.ts +27 -0
  133. package/types/ParseInstallation.d.ts +179 -0
  134. package/types/ParseLiveQuery.d.ts +48 -0
  135. package/types/ParseObject.d.ts +1072 -0
  136. package/types/ParseOp.d.ts +78 -0
  137. package/types/ParsePolygon.d.ts +69 -0
  138. package/types/ParseQuery.d.ts +961 -0
  139. package/types/ParseRelation.d.ts +56 -0
  140. package/types/ParseRole.d.ts +79 -0
  141. package/types/ParseSchema.d.ts +286 -0
  142. package/types/ParseSession.d.ts +45 -0
  143. package/types/ParseUser.d.ts +517 -0
  144. package/types/Push.d.ts +62 -0
  145. package/types/RESTController.d.ts +35 -0
  146. package/types/SingleInstanceStateController.d.ts +24 -0
  147. package/types/Socket.weapp.d.ts +10 -0
  148. package/types/Storage.d.ts +14 -0
  149. package/types/StorageController.browser.d.ts +9 -0
  150. package/types/StorageController.d.ts +2 -0
  151. package/types/StorageController.default.d.ts +9 -0
  152. package/types/StorageController.react-native.d.ts +11 -0
  153. package/types/StorageController.weapp.d.ts +9 -0
  154. package/types/TaskQueue.d.ts +11 -0
  155. package/types/UniqueInstanceStateController.d.ts +20 -0
  156. package/types/WebSocketController.d.ts +2 -0
  157. package/types/Xhr.weapp.d.ts +29 -0
  158. package/types/arrayContainsObject.d.ts +2 -0
  159. package/types/canBeSerialized.d.ts +2 -0
  160. package/types/decode.d.ts +1 -0
  161. package/types/encode.d.ts +1 -0
  162. package/types/equals.d.ts +1 -0
  163. package/types/escape.d.ts +1 -0
  164. package/types/index.d.ts +66 -0
  165. package/types/isRevocableSession.d.ts +1 -0
  166. package/types/node.d.ts +3 -0
  167. package/types/parseDate.d.ts +1 -0
  168. package/types/promiseUtils.d.ts +9 -0
  169. package/types/react-native.d.ts +3 -0
  170. package/types/tests.ts +2256 -0
  171. package/types/tsconfig.json +25 -0
  172. package/types/unique.d.ts +1 -0
  173. package/types/unsavedChildren.d.ts +11 -0
  174. package/types/uuid.d.ts +2 -0
@@ -0,0 +1,307 @@
1
+ /**
2
+ * Defines a Cloud Function.
3
+ *
4
+ * **Available in Cloud Code only.**
5
+ *
6
+ * @function define
7
+ * @name Parse.Cloud.define
8
+ * @param {string} name The name of the Cloud Function
9
+ * @param {Function} data The Cloud Function to register. This function should take one parameter {@link Parse.Cloud.FunctionRequest}
10
+ */
11
+ /**
12
+ * Registers an after delete function.
13
+ *
14
+ * **Available in Cloud Code only.**
15
+ *
16
+ * If you want to use afterDelete for a predefined class in the Parse JavaScript SDK (e.g. {@link Parse.User}), you should pass the class itself and not the String for arg1.
17
+ * ```
18
+ * Parse.Cloud.afterDelete('MyCustomClass', (request) => {
19
+ * // code here
20
+ * })
21
+ *
22
+ * Parse.Cloud.afterDelete(Parse.User, (request) => {
23
+ * // code here
24
+ * })
25
+ *```
26
+ *
27
+ * @function afterDelete
28
+ * @name Parse.Cloud.afterDelete
29
+ * @param {(string | Parse.Object)} arg1 The Parse.Object subclass to register the after delete function for. This can instead be a String that is the className of the subclass.
30
+ * @param {Function} func The function to run after a delete. This function should take just one parameter, {@link Parse.Cloud.TriggerRequest}.
31
+ */
32
+ /**
33
+ *
34
+ * Registers an after save function.
35
+ *
36
+ * **Available in Cloud Code only.**
37
+ *
38
+ * If you want to use afterSave for a predefined class in the Parse JavaScript SDK (e.g. {@link Parse.User}), you should pass the class itself and not the String for arg1.
39
+ *
40
+ * ```
41
+ * Parse.Cloud.afterSave('MyCustomClass', function(request) {
42
+ * // code here
43
+ * })
44
+ *
45
+ * Parse.Cloud.afterSave(Parse.User, function(request) {
46
+ * // code here
47
+ * })
48
+ * ```
49
+ *
50
+ * @function afterSave
51
+ * @name Parse.Cloud.afterSave
52
+ * @param {(string | Parse.Object)} arg1 The Parse.Object subclass to register the after save function for. This can instead be a String that is the className of the subclass.
53
+ * @param {Function} func The function to run after a save. This function should take just one parameter, {@link Parse.Cloud.TriggerRequest}.
54
+ */
55
+ /**
56
+ * Registers an before delete function.
57
+ *
58
+ * **Available in Cloud Code only.**
59
+ *
60
+ * If you want to use beforeDelete for a predefined class in the Parse JavaScript SDK (e.g. {@link Parse.User}), you should pass the class itself and not the String for arg1.
61
+ * ```
62
+ * Parse.Cloud.beforeDelete('MyCustomClass', (request) => {
63
+ * // code here
64
+ * })
65
+ *
66
+ * Parse.Cloud.beforeDelete(Parse.User, (request) => {
67
+ * // code here
68
+ * })
69
+ *```
70
+ *
71
+ * @function beforeDelete
72
+ * @name Parse.Cloud.beforeDelete
73
+ * @param {(string | Parse.Object)} arg1 The Parse.Object subclass to register the before delete function for. This can instead be a String that is the className of the subclass.
74
+ * @param {Function} func The function to run before a delete. This function should take just one parameter, {@link Parse.Cloud.TriggerRequest}.
75
+ */
76
+ /**
77
+ *
78
+ * Registers an before save function.
79
+ *
80
+ * **Available in Cloud Code only.**
81
+ *
82
+ * If you want to use beforeSave for a predefined class in the Parse JavaScript SDK (e.g. {@link Parse.User}), you should pass the class itself and not the String for arg1.
83
+ *
84
+ * ```
85
+ * Parse.Cloud.beforeSave('MyCustomClass', (request) => {
86
+ * // code here
87
+ * })
88
+ *
89
+ * Parse.Cloud.beforeSave(Parse.User, (request) => {
90
+ * // code here
91
+ * })
92
+ * ```
93
+ *
94
+ * @function beforeSave
95
+ * @name Parse.Cloud.beforeSave
96
+ * @param {(string | Parse.Object)} arg1 The Parse.Object subclass to register the after save function for. This can instead be a String that is the className of the subclass.
97
+ * @param {Function} func The function to run before a save. This function should take just one parameter, {@link Parse.Cloud.TriggerRequest}.
98
+ */
99
+ /**
100
+ *
101
+ * Registers an before save file function. A new Parse.File can be returned to override the file that gets saved.
102
+ * If you want to replace the rquesting Parse.File with a Parse.File that is already saved, simply return the already saved Parse.File.
103
+ * You can also add metadata to the file that will be stored via whatever file storage solution you're using.
104
+ *
105
+ * **Available in Cloud Code only.**
106
+ *
107
+ * Example: Adding metadata and tags
108
+ * ```
109
+ * Parse.Cloud.beforeSaveFile(({ file, user }) => {
110
+ * file.addMetadata('foo', 'bar');
111
+ * file.addTag('createdBy', user.id);
112
+ * });
113
+ *
114
+ * ```
115
+ *
116
+ * Example: replacing file with an already saved file
117
+ *
118
+ * ```
119
+ * Parse.Cloud.beforeSaveFile(({ file, user }) => {
120
+ * return user.get('avatar');
121
+ * });
122
+ *
123
+ * ```
124
+ *
125
+ * Example: replacing file with a different file
126
+ *
127
+ * ```
128
+ * Parse.Cloud.beforeSaveFile(({ file, user }) => {
129
+ * const metadata = { foo: 'bar' };
130
+ * const tags = { createdBy: user.id };
131
+ * const newFile = new Parse.File(file.name(), <some other file data>, 'text/plain', metadata, tags);
132
+ * return newFile;
133
+ * });
134
+ *
135
+ * ```
136
+ *
137
+ * @function beforeSaveFile
138
+ * @name Parse.Cloud.beforeSaveFile
139
+ * @param {Function} func The function to run before a file saves. This function should take one parameter, a {@link Parse.Cloud.FileTriggerRequest}.
140
+ */
141
+ /**
142
+ *
143
+ * Registers an after save file function.
144
+ *
145
+ * **Available in Cloud Code only.**
146
+ *
147
+ * Example: creating a new object that references this file in a separate collection
148
+ * ```
149
+ * Parse.Cloud.afterSaveFile(async ({ file, user }) => {
150
+ * const fileObject = new Parse.Object('FileObject');
151
+ * fileObject.set('metadata', file.metadata());
152
+ * fileObject.set('tags', file.tags());
153
+ * fileObject.set('name', file.name());
154
+ * fileObject.set('createdBy', user);
155
+ * await fileObject.save({ sessionToken: user.getSessionToken() });
156
+ * });
157
+ *
158
+ * @method afterSaveFile
159
+ * @name Parse.Cloud.afterSaveFile
160
+ * @param {Function} func The function to run after a file saves. This function should take one parameter, a {@link Parse.Cloud.FileTriggerRequest}.
161
+ */
162
+ /**
163
+ * @function beforeConnect
164
+ * @name Parse.Cloud.beforeConnect
165
+ * @param {Function} func The function to before connection is made. This function can be async and should take just one parameter, {@link Parse.Cloud.ConnectTriggerRequest}.
166
+ */
167
+ /**
168
+ *
169
+ * Registers a before connect function.
170
+ *
171
+ * **Available in Cloud Code only.**
172
+ *
173
+ * Example: restrict LiveQueries to logged in users.
174
+ * ```
175
+ * Parse.Cloud.beforeConnect((request) => {
176
+ * if (!request.user) {
177
+ * throw "Please login before you attempt to connect."
178
+ * }
179
+ * });
180
+ * ```
181
+ */
182
+ /**
183
+ * @function beforeSubscribe
184
+ * @name Parse.Cloud.beforeSubscribe
185
+ * @param {(string | Parse.Object)} arg1 The Parse.Object subclass to register the before subscription function for. This can instead be a String that is the className of the subclass.
186
+ * @param {Function} func The function to run before a subscription. This function can be async and should take one parameter, a {@link Parse.Cloud.TriggerRequest}.
187
+ */
188
+ /**
189
+ *
190
+ * Registers a before subscribe function.
191
+ *
192
+ * **Available in Cloud Code only.**
193
+ * Example: restrict subscriptions to MyObject to Admin accounts only.
194
+ * ```
195
+ * Parse.Cloud.beforeSubscribe('MyObject', (request) => {
196
+ * if (!request.user.get('Admin')) {
197
+ * throw new Parse.Error(101, 'You are not authorized to subscribe to MyObject.');
198
+ * }
199
+ * let query = request.query; // the Parse.Query
200
+ * query.select("name","year")
201
+ * });
202
+ * ```
203
+ */
204
+ /**
205
+ * Makes an HTTP Request.
206
+ *
207
+ * **Available in Cloud Code only.**
208
+ *
209
+ * By default, Parse.Cloud.httpRequest does not follow redirects caused by HTTP 3xx response codes. You can use the followRedirects option in the {@link Parse.Cloud.HTTPOptions} object to change this behavior.
210
+ *
211
+ * Sample request:
212
+ * ```
213
+ * Parse.Cloud.httpRequest({
214
+ * url: 'http://www.example.com/'
215
+ * }).then(function(httpResponse) {
216
+ * // success
217
+ * console.log(httpResponse.text);
218
+ * },function(httpResponse) {
219
+ * // error
220
+ * console.error('Request failed with response code ' + httpResponse.status);
221
+ * });
222
+ * ```
223
+ *
224
+ * @function httpRequest
225
+ * @name Parse.Cloud.httpRequest
226
+ * @param {Parse.Cloud.HTTPOptions} options The Parse.Cloud.HTTPOptions object that makes the request.
227
+ * @returns {Promise<Parse.Cloud.HTTPResponse>} A promise that will be resolved with a {@link Parse.Cloud.HTTPResponse} object when the request completes.
228
+ */
229
+ /**
230
+ * Defines a Background Job.
231
+ *
232
+ * **Available in Cloud Code only.**
233
+ *
234
+ * @function job
235
+ * @name Parse.Cloud.job
236
+ * @param {string} name The name of the Background Job
237
+ * @param {Function} func The Background Job to register. This function should take two parameters a {@link Parse.Cloud.JobRequest} and a {@link Parse.Cloud.JobStatus}
238
+ */
239
+ /**
240
+ * @typedef Parse.Cloud.TriggerRequest
241
+ * @property {string} installationId If set, the installationId triggering the request.
242
+ * @property {boolean} master If true, means the master key was used.
243
+ * @property {Parse.User} user If set, the user that made the request.
244
+ * @property {Parse.Object} object The object triggering the hook.
245
+ * @property {string} ip The IP address of the client making the request.
246
+ * @property {object} headers The original HTTP headers for the request.
247
+ * @property {string} triggerName The name of the trigger (`beforeSave`, `afterSave`, ...)
248
+ * @property {object} log The current logger inside Parse Server.
249
+ * @property {Parse.Object} original If set, the object, as currently stored.
250
+ */
251
+ /**
252
+ * @typedef Parse.Cloud.FileTriggerRequest
253
+ * @property {string} installationId If set, the installationId triggering the request.
254
+ * @property {boolean} master If true, means the master key was used.
255
+ * @property {Parse.User} user If set, the user that made the request.
256
+ * @property {Parse.File} file The file triggering the hook.
257
+ * @property {string} ip The IP address of the client making the request.
258
+ * @property {object} headers The original HTTP headers for the request.
259
+ * @property {string} triggerName The name of the trigger (`beforeSaveFile`, `afterSaveFile`, ...)
260
+ * @property {object} log The current logger inside Parse Server.
261
+ */
262
+ /**
263
+ * @typedef Parse.Cloud.ConnectTriggerRequest
264
+ * @property {string} installationId If set, the installationId triggering the request.
265
+ * @property {boolean} useMasterKey If true, means the master key was used.
266
+ * @property {Parse.User} user If set, the user that made the request.
267
+ * @property {number} clients The number of clients connected.
268
+ * @property {number} subscriptions The number of subscriptions connected.
269
+ * @property {string} sessionToken If set, the session of the user that made the request.
270
+ */
271
+ /**
272
+ * @typedef Parse.Cloud.FunctionRequest
273
+ * @property {string} installationId If set, the installationId triggering the request.
274
+ * @property {boolean} master If true, means the master key was used.
275
+ * @property {Parse.User} user If set, the user that made the request.
276
+ * @property {object} params The params passed to the cloud function.
277
+ */
278
+ /**
279
+ * @typedef Parse.Cloud.JobRequest
280
+ * @property {object} params The params passed to the background job.
281
+ */
282
+ /**
283
+ * @typedef Parse.Cloud.JobStatus
284
+ * @property {Function} error If error is called, will end the job unsuccessfully with an optional completion message to be stored in the job status.
285
+ * @property {Function} message If message is called with a string argument, will update the current message to be stored in the job status.
286
+ * @property {Function} success If success is called, will end the job successfullly with the optional completion message to be stored in the job status.
287
+ */
288
+ /**
289
+ * @typedef Parse.Cloud.HTTPOptions
290
+ * @property {string | object} body The body of the request. If it is a JSON object, then the Content-Type set in the headers must be application/x-www-form-urlencoded or application/json. You can also set this to a {@link Buffer} object to send raw bytes. If you use a Buffer, you should also set the Content-Type header explicitly to describe what these bytes represent.
291
+ * @property {Function} error The function that is called when the request fails. It will be passed a Parse.Cloud.HTTPResponse object.
292
+ * @property {boolean} followRedirects Whether to follow redirects caused by HTTP 3xx responses. Defaults to false.
293
+ * @property {object} headers The headers for the request.
294
+ * @property {string} method The method of the request. GET, POST, PUT, DELETE, HEAD, and OPTIONS are supported. Will default to GET if not specified.
295
+ * @property {string | object} params The query portion of the url. You can pass a JSON object of key value pairs like params: {q : 'Sean Plott'} or a raw string like params:q=Sean Plott.
296
+ * @property {Function} success The function that is called when the request successfully completes. It will be passed a Parse.Cloud.HTTPResponse object.
297
+ * @property {string} url The url to send the request to.
298
+ */
299
+ /**
300
+ * @typedef Parse.Cloud.HTTPResponse
301
+ * @property {Buffer} buffer The raw byte representation of the response body. Use this to receive binary data. See Buffer for more details.
302
+ * @property {object} cookies The cookies sent by the server. The keys in this object are the names of the cookies. The values are Parse.Cloud.Cookie objects.
303
+ * @property {object} data The parsed response body as a JavaScript object. This is only available when the response Content-Type is application/x-www-form-urlencoded or application/json.
304
+ * @property {object} headers The headers sent by the server. The keys in this object are the names of the headers. We do not support multiple response headers with the same name. In the common case of Set-Cookie headers, please use the cookies field instead.
305
+ * @property {number} status The status code.
306
+ * @property {string} text The raw text representation of the response body.
307
+ */
@@ -0,0 +1,325 @@
1
+ import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';
2
+ import type ParseFile from './ParseFile';
3
+ import type { FileSaveOptions, FileSource } from './ParseFile';
4
+ import type { Op } from './ParseOp';
5
+ import type ParseObject from './ParseObject';
6
+ import type { SaveOptions } from './ParseObject';
7
+ import type { QueryJSON } from './ParseQuery';
8
+ import type ParseUser from './ParseUser';
9
+ import type { AuthData } from './ParseUser';
10
+ import type { PushData } from './Push';
11
+ import type { RequestOptions, FullOptions } from './RESTController';
12
+ import type ParseSession from './ParseSession';
13
+ import type { HookDeclaration, HookDeleteArg } from './ParseHooks';
14
+ import type ParseConfig from './ParseConfig';
15
+ import type LiveQueryClient from './LiveQueryClient';
16
+ import type ParseInstallation from './ParseInstallation';
17
+ type AnalyticsController = {
18
+ track: (name: string, dimensions: {
19
+ [key: string]: string;
20
+ }) => Promise<any>;
21
+ };
22
+ type CloudController = {
23
+ run: (name: string, data: any, options?: RequestOptions) => Promise<any>;
24
+ getJobsData: (options?: RequestOptions) => Promise<any>;
25
+ /** Returns promise which resolves with JobStatusId of the job */
26
+ startJob: (name: string, data: any, options?: RequestOptions) => Promise<string>;
27
+ };
28
+ type ConfigController = {
29
+ current: () => Promise<ParseConfig> | ParseConfig;
30
+ get: (opts?: RequestOptions) => Promise<ParseConfig>;
31
+ save: (attrs: {
32
+ [key: string]: any;
33
+ }, masterKeyOnlyFlags?: {
34
+ [key: string]: any;
35
+ }) => Promise<void>;
36
+ };
37
+ type CryptoController = {
38
+ encrypt: (obj: any, secretKey: string) => string;
39
+ decrypt: (encryptedText: string, secretKey: any) => string;
40
+ };
41
+ type FileController = {
42
+ saveFile: (name: string, source: FileSource, options?: FullOptions) => Promise<any>;
43
+ saveBase64: (name: string, source: FileSource, options?: FileSaveOptions) => Promise<{
44
+ name: string;
45
+ url: string;
46
+ }>;
47
+ download: (uri: string, options?: any) => Promise<{
48
+ base64?: string;
49
+ contentType?: string;
50
+ }>;
51
+ deleteFile: (name: string, options?: {
52
+ useMasterKey?: boolean;
53
+ }) => Promise<void>;
54
+ };
55
+ type InstallationController = {
56
+ currentInstallationId: () => Promise<string>;
57
+ currentInstallation: () => Promise<ParseInstallation | null>;
58
+ updateInstallationOnDisk: (installation: ParseInstallation) => Promise<void>;
59
+ };
60
+ type ObjectController = {
61
+ fetch: (object: ParseObject | Array<ParseObject>, forceFetch: boolean, options?: RequestOptions) => Promise<Array<ParseObject | undefined> | ParseObject | undefined>;
62
+ save: (object: ParseObject | Array<ParseObject | ParseFile> | null, options?: RequestOptions) => Promise<ParseObject | Array<ParseObject> | ParseFile | undefined>;
63
+ destroy: (object: ParseObject | Array<ParseObject>, options?: RequestOptions) => Promise<ParseObject | Array<ParseObject>>;
64
+ };
65
+ type ObjectStateController = {
66
+ getState: (obj: any) => State | null;
67
+ initializeState: (obj: any, initial?: State) => State;
68
+ removeState: (obj: any) => State | null;
69
+ getServerData: (obj: any) => AttributeMap;
70
+ setServerData: (obj: any, attributes: AttributeMap) => void;
71
+ getPendingOps: (obj: any) => Array<OpsMap>;
72
+ setPendingOp: (obj: any, attr: string, op?: Op) => void;
73
+ pushPendingState: (obj: any) => void;
74
+ popPendingState: (obj: any) => OpsMap | undefined;
75
+ mergeFirstPendingState: (obj: any) => void;
76
+ getObjectCache: (obj: any) => ObjectCache;
77
+ estimateAttribute: (obj: any, attr: string) => any;
78
+ estimateAttributes: (obj: any) => AttributeMap;
79
+ commitServerChanges: (obj: any, changes: AttributeMap) => void;
80
+ enqueueTask: (obj: any, task: () => Promise<void>) => Promise<void>;
81
+ clearAllState: () => void;
82
+ duplicateState: (source: any, dest: any) => void;
83
+ };
84
+ type PushController = {
85
+ send: (data: PushData, options?: FullOptions) => Promise<any>;
86
+ };
87
+ type QueryController = {
88
+ find(className: string, params: QueryJSON, options?: RequestOptions): Promise<{
89
+ results?: Array<ParseObject>;
90
+ className?: string;
91
+ count?: number;
92
+ }>;
93
+ aggregate(className: string, params: any, options?: RequestOptions): Promise<{
94
+ results?: Array<any>;
95
+ }>;
96
+ };
97
+ export type QueueObject = {
98
+ queueId: string;
99
+ action: string;
100
+ object: ParseObject;
101
+ serverOptions: SaveOptions | RequestOptions;
102
+ id: string;
103
+ className: string;
104
+ hash: string;
105
+ createdAt: Date;
106
+ };
107
+ export type Queue = Array<QueueObject>;
108
+ export type EventuallyQueue = {
109
+ save: (object: ParseObject, serverOptions?: SaveOptions) => Promise<void>;
110
+ destroy: (object: ParseObject, serverOptions?: RequestOptions) => Promise<void>;
111
+ generateQueueId: (action: string, object: ParseObject) => string;
112
+ enqueue(action: string, object: ParseObject, serverOptions?: SaveOptions | RequestOptions): Promise<void>;
113
+ store(data: Queue): Promise<void>;
114
+ load(): Promise<string | null>;
115
+ getQueue(): Promise<Queue>;
116
+ setQueue(queue: Queue): Promise<void>;
117
+ remove(queueId: string): Promise<void>;
118
+ clear(): Promise<void>;
119
+ queueItemExists(queue: Queue, queueId: string): number;
120
+ length(): Promise<number>;
121
+ sendQueue(): Promise<boolean>;
122
+ sendQueueCallback(object: ParseObject, queueObject: QueueObject): Promise<void>;
123
+ poll(ms?: number): void;
124
+ stopPoll(): void;
125
+ isPolling(): boolean;
126
+ process: {
127
+ create(ObjectType: any, queueObject: any): Promise<void>;
128
+ byId(ObjectType: any, queueObject: any): Promise<void>;
129
+ byHash(ObjectType: any, queueObject: any): Promise<void>;
130
+ };
131
+ };
132
+ type RESTController = {
133
+ request: (method: string, path: string, data?: any, options?: RequestOptions) => Promise<any>;
134
+ ajax: (method: string, url: string, data: any, headers?: any, options?: FullOptions) => Promise<any>;
135
+ handleError: (err?: any) => void;
136
+ };
137
+ type SchemaController = {
138
+ purge: (className: string) => Promise<any>;
139
+ get: (className: string, options?: RequestOptions) => Promise<any>;
140
+ delete: (className: string, options?: RequestOptions) => Promise<void>;
141
+ create: (className: string, params: any, options?: RequestOptions) => Promise<any>;
142
+ update: (className: string, params: any, options?: RequestOptions) => Promise<any>;
143
+ send(className: string, method: string, params: any, options?: RequestOptions): Promise<any>;
144
+ };
145
+ type SessionController = {
146
+ getSession: (options?: RequestOptions) => Promise<ParseSession>;
147
+ };
148
+ type StorageController = {
149
+ async: 0;
150
+ getItem: (path: string) => string | null;
151
+ setItem: (path: string, value: string) => void;
152
+ removeItem: (path: string) => void;
153
+ getItemAsync?: (path: string) => Promise<string | null>;
154
+ setItemAsync?: (path: string, value: string) => Promise<void>;
155
+ removeItemAsync?: (path: string) => Promise<void>;
156
+ clear: () => void;
157
+ getAllKeys?: () => Array<string>;
158
+ getAllKeysAsync?: () => Promise<Array<string>>;
159
+ } | {
160
+ async: 1;
161
+ getItem?: (path: string) => string | null;
162
+ setItem?: (path: string, value: string) => void;
163
+ removeItem?: (path: string) => void;
164
+ getItemAsync: (path: string) => Promise<string | null>;
165
+ setItemAsync: (path: string, value: string) => Promise<void>;
166
+ removeItemAsync: (path: string) => Promise<void>;
167
+ clear: () => void;
168
+ getAllKeys?: () => Array<string>;
169
+ getAllKeysAsync?: () => Promise<Array<string>>;
170
+ };
171
+ type LocalDatastoreController = {
172
+ fromPinWithName: (name: string) => any | undefined;
173
+ pinWithName: (name: string, objects: any) => void;
174
+ unPinWithName: (name: string) => void;
175
+ getAllContents: () => any | undefined;
176
+ clear: () => void;
177
+ };
178
+ type UserController = {
179
+ setCurrentUser: (user: ParseUser) => Promise<void>;
180
+ currentUser: () => ParseUser | null;
181
+ currentUserAsync: () => Promise<ParseUser | null>;
182
+ signUp: (user: ParseUser, attrs: AttributeMap, options?: RequestOptions) => Promise<ParseUser>;
183
+ logIn: (user: ParseUser, options?: RequestOptions) => Promise<ParseUser>;
184
+ loginAs: (user: ParseUser, userId: string) => Promise<ParseUser>;
185
+ become: (user: ParseUser, options?: RequestOptions) => Promise<ParseUser>;
186
+ hydrate: (user: ParseUser, userJSON: AttributeMap) => Promise<ParseUser>;
187
+ logOut: (options?: RequestOptions) => Promise<void>;
188
+ me: (user: ParseUser, options?: RequestOptions) => Promise<ParseUser>;
189
+ requestPasswordReset: (email: string, options?: RequestOptions) => Promise<void>;
190
+ updateUserOnDisk: (user: ParseUser) => Promise<ParseUser>;
191
+ upgradeToRevocableSession: (user: ParseUser, options?: RequestOptions) => Promise<void>;
192
+ linkWith: (user: ParseUser, authData: AuthData, options?: FullOptions) => Promise<ParseUser>;
193
+ removeUserFromDisk: () => Promise<ParseUser | void>;
194
+ verifyPassword: (username: string, password: string, options?: RequestOptions) => Promise<ParseUser>;
195
+ requestEmailVerification: (email: string, options?: RequestOptions) => Promise<void>;
196
+ };
197
+ type HooksController = {
198
+ get: (type: string, functionName?: string, triggerName?: string) => Promise<any>;
199
+ create: (hook: HookDeclaration) => Promise<any>;
200
+ remove: (hook: HookDeleteArg) => Promise<any>;
201
+ update: (hook: HookDeclaration) => Promise<any>;
202
+ sendRequest?: (method: string, path: string, body?: any) => Promise<any>;
203
+ };
204
+ type LiveQueryControllerType = {
205
+ setDefaultLiveQueryClient(liveQueryClient: LiveQueryClient): void;
206
+ getDefaultLiveQueryClient(): Promise<LiveQueryClient>;
207
+ _clearCachedDefaultClient(): void;
208
+ };
209
+ /** Based on https://github.com/react-native-async-storage/async-storage/blob/main/packages/default-storage-backend/src/types.ts */
210
+ type AsyncStorageType = {
211
+ /** Fetches an item for a `key` and invokes a callback upon completion. */
212
+ getItem: (key: string, callback?: (error?: Error | null, result?: string | null) => void) => Promise<string | null>;
213
+ /** Sets the value for a `key` and invokes a callback upon completion. */
214
+ setItem: (key: string, value: string, callback?: (error?: Error | null) => void) => Promise<void>;
215
+ /** Removes an item for a `key` and invokes a callback upon completion. */
216
+ removeItem: (key: string, callback?: (error?: Error | null) => void) => Promise<void>;
217
+ /** Merges an existing `key` value with an input value, assuming both values are stringified JSON. */
218
+ mergeItem: (key: string, value: string, callback?: (error?: Error | null) => void) => Promise<void>;
219
+ /**
220
+ * Erases *all* `AsyncStorage` for all clients, libraries, etc. You probably
221
+ * don't want to call this; use `removeItem` or `multiRemove` to clear only
222
+ * your app's keys.
223
+ */
224
+ clear: (callback?: (error?: Error | null) => void) => Promise<void>;
225
+ /** Gets *all* keys known to your app; for all callers, libraries, etc. */
226
+ getAllKeys: (callback?: (error?: Error | null, result?: readonly string[] | null) => void) => Promise<readonly string[]>;
227
+ /**
228
+ * This allows you to batch the fetching of items given an array of `key`
229
+ * inputs. Your callback will be invoked with an array of corresponding
230
+ * key-value pairs found.
231
+ */
232
+ multiGet: (keys: readonly string[], callback?: (errors?: readonly (Error | null)[] | null, result?: readonly [string, string][]) => void) => Promise<readonly [string, string | null][]>;
233
+ /**
234
+ * Use this as a batch operation for storing multiple key-value pairs. When
235
+ * the operation completes you'll get a single callback with any errors.
236
+ *
237
+ * See https://react-native-async-storage.github.io/async-storage/docs/api#multiset
238
+ */
239
+ multiSet: (keyValuePairs: [string, string][], callback?: (errors?: readonly (Error | null)[] | null) => void) => Promise<readonly [string, string | null][]>;
240
+ /**
241
+ * Call this to batch the deletion of all keys in the `keys` array.
242
+ *
243
+ * See https://react-native-async-storage.github.io/async-storage/docs/api#multiremove
244
+ */
245
+ multiRemove: (keys: readonly string[], callback?: (errors?: readonly (Error | null)[] | null) => void) => Promise<void>;
246
+ /**
247
+ * Batch operation to merge in existing and new values for a given set of
248
+ * keys. This assumes that the values are stringified JSON.
249
+ *
250
+ * See https://react-native-async-storage.github.io/async-storage/docs/api#multimerge
251
+ */
252
+ multiMerge: (keyValuePairs: [string, string][], callback?: (errors?: readonly (Error | null)[] | null) => void) => Promise<void>;
253
+ };
254
+ export type WebSocketController = {
255
+ onopen: () => void;
256
+ onmessage: (message: any) => void;
257
+ onclose: (arg?: any) => void;
258
+ onerror: (error: any) => void;
259
+ send: (data: any) => void;
260
+ close: () => void;
261
+ };
262
+ declare const CoreManager: {
263
+ get: (key: string) => any;
264
+ set: (key: string, value: any) => void;
265
+ setIfNeeded: (key: string, value: any) => any;
266
+ setAnalyticsController(controller: AnalyticsController): void;
267
+ getAnalyticsController(): AnalyticsController;
268
+ setCloudController(controller: CloudController): void;
269
+ getCloudController(): CloudController;
270
+ setConfigController(controller: ConfigController): void;
271
+ getConfigController(): ConfigController;
272
+ setCryptoController(controller: CryptoController): void;
273
+ getCryptoController(): CryptoController;
274
+ setEventEmitter(eventEmitter: any): void;
275
+ getEventEmitter(): any;
276
+ setFileController(controller: FileController): void;
277
+ setEventuallyQueue(controller: EventuallyQueue): void;
278
+ getEventuallyQueue(): EventuallyQueue;
279
+ getFileController(): FileController;
280
+ setInstallationController(controller: InstallationController): void;
281
+ getInstallationController(): InstallationController;
282
+ setLiveQuery(liveQuery: any): void;
283
+ getLiveQuery(): any;
284
+ setObjectController(controller: ObjectController): void;
285
+ getObjectController(): ObjectController;
286
+ setObjectStateController(controller: ObjectStateController): void;
287
+ getObjectStateController(): ObjectStateController;
288
+ setPushController(controller: PushController): void;
289
+ getPushController(): PushController;
290
+ setQueryController(controller: QueryController): void;
291
+ getQueryController(): QueryController;
292
+ setRESTController(controller: RESTController): void;
293
+ getRESTController(): RESTController;
294
+ setSchemaController(controller: SchemaController): void;
295
+ getSchemaController(): SchemaController;
296
+ setSessionController(controller: SessionController): void;
297
+ getSessionController(): SessionController;
298
+ setStorageController(controller: StorageController): void;
299
+ setLocalDatastoreController(controller: LocalDatastoreController): void;
300
+ getLocalDatastoreController(): LocalDatastoreController;
301
+ setLocalDatastore(store: any): void;
302
+ getLocalDatastore(): any;
303
+ getStorageController(): StorageController;
304
+ setAsyncStorage(storage: AsyncStorageType): void;
305
+ getAsyncStorage(): AsyncStorageType;
306
+ setWebSocketController(controller: new (url: string | URL, protocols?: string | string[] | undefined) => WebSocketController): void;
307
+ getWebSocketController(): new (url: string | URL, protocols?: string | string[] | undefined) => WebSocketController;
308
+ setUserController(controller: UserController): void;
309
+ getUserController(): UserController;
310
+ setLiveQueryController(controller: LiveQueryControllerType): void;
311
+ getLiveQueryController(): LiveQueryControllerType;
312
+ setHooksController(controller: HooksController): void;
313
+ getHooksController(): HooksController;
314
+ setParseOp(op: any): void;
315
+ getParseOp(): any;
316
+ setParseObject(object: any): void;
317
+ getParseObject(): any;
318
+ setParseQuery(query: any): void;
319
+ getParseQuery(): any;
320
+ setParseRole(role: any): void;
321
+ getParseRole(): any;
322
+ setParseUser(user: any): void;
323
+ getParseUser(): any;
324
+ };
325
+ export default CoreManager;
@@ -0,0 +1,5 @@
1
+ declare const CryptoController: {
2
+ encrypt(obj: any, secretKey: string): string;
3
+ decrypt(encryptedText: string, secretKey: string): string;
4
+ };
5
+ export default CryptoController;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This is a simple wrapper to unify EventEmitter implementations across platforms.
3
+ */
4
+ declare let EventEmitter: any;
5
+ export default EventEmitter;