parse 6.1.0-alpha.1 → 6.1.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/README.md +0 -8
  2. package/dist/parse.js +93 -105
  3. package/dist/parse.min.js +2 -2
  4. package/dist/parse.weapp.js +93 -105
  5. package/dist/parse.weapp.min.js +2 -2
  6. package/lib/browser/Cloud.js +1 -0
  7. package/lib/browser/CoreManager.js +2 -2
  8. package/lib/browser/CryptoController.js +0 -1
  9. package/lib/browser/EventEmitter.js +0 -1
  10. package/lib/browser/EventuallyQueue.js +6 -10
  11. package/lib/browser/IndexedDBStorageController.js +0 -1
  12. package/lib/browser/InstallationController.js +0 -1
  13. package/lib/browser/LiveQuerySubscription.js +4 -4
  14. package/lib/browser/LocalDatastore.js +0 -1
  15. package/lib/browser/LocalDatastoreController.default.js +0 -1
  16. package/lib/browser/LocalDatastoreController.js +0 -1
  17. package/lib/browser/LocalDatastoreController.react-native.js +0 -1
  18. package/lib/browser/OfflineQuery.js +0 -1
  19. package/lib/browser/Parse.js +12 -1
  20. package/lib/browser/ParseACL.js +1 -1
  21. package/lib/browser/ParseConfig.js +2 -4
  22. package/lib/browser/ParseInstallation.js +0 -1
  23. package/lib/browser/ParseLiveQuery.js +2 -2
  24. package/lib/browser/ParseObject.js +10 -10
  25. package/lib/browser/ParseQuery.js +26 -25
  26. package/lib/browser/ParseRole.js +1 -1
  27. package/lib/browser/ParseSchema.js +6 -6
  28. package/lib/browser/ParseUser.js +10 -12
  29. package/lib/browser/RESTController.js +7 -3
  30. package/lib/browser/Socket.weapp.js +0 -1
  31. package/lib/browser/Storage.js +0 -1
  32. package/lib/browser/StorageController.browser.js +0 -1
  33. package/lib/browser/StorageController.default.js +0 -1
  34. package/lib/browser/StorageController.js +0 -1
  35. package/lib/browser/StorageController.react-native.js +0 -1
  36. package/lib/browser/StorageController.weapp.js +0 -1
  37. package/lib/browser/TaskQueue.js +0 -1
  38. package/lib/browser/WebSocketController.js +0 -1
  39. package/lib/browser/Xhr.weapp.js +0 -1
  40. package/lib/browser/uuid.js +0 -1
  41. package/lib/node/Cloud.js +1 -0
  42. package/lib/node/CoreManager.js +2 -2
  43. package/lib/node/CryptoController.js +0 -1
  44. package/lib/node/EventEmitter.js +0 -1
  45. package/lib/node/EventuallyQueue.js +6 -7
  46. package/lib/node/IndexedDBStorageController.js +0 -1
  47. package/lib/node/InstallationController.js +0 -1
  48. package/lib/node/LiveQuerySubscription.js +4 -4
  49. package/lib/node/LocalDatastore.js +0 -1
  50. package/lib/node/LocalDatastoreController.default.js +0 -1
  51. package/lib/node/LocalDatastoreController.js +0 -1
  52. package/lib/node/LocalDatastoreController.react-native.js +0 -1
  53. package/lib/node/OfflineQuery.js +0 -1
  54. package/lib/node/Parse.js +12 -1
  55. package/lib/node/ParseACL.js +1 -1
  56. package/lib/node/ParseConfig.js +2 -2
  57. package/lib/node/ParseInstallation.js +0 -1
  58. package/lib/node/ParseLiveQuery.js +2 -2
  59. package/lib/node/ParseObject.js +10 -7
  60. package/lib/node/ParseQuery.js +7 -7
  61. package/lib/node/ParseRole.js +1 -1
  62. package/lib/node/ParseSchema.js +6 -4
  63. package/lib/node/ParseUser.js +10 -10
  64. package/lib/node/RESTController.js +3 -1
  65. package/lib/node/Socket.weapp.js +0 -1
  66. package/lib/node/Storage.js +0 -1
  67. package/lib/node/StorageController.browser.js +0 -1
  68. package/lib/node/StorageController.default.js +0 -1
  69. package/lib/node/StorageController.js +0 -1
  70. package/lib/node/StorageController.react-native.js +0 -1
  71. package/lib/node/StorageController.weapp.js +0 -1
  72. package/lib/node/TaskQueue.js +0 -1
  73. package/lib/node/WebSocketController.js +0 -1
  74. package/lib/node/Xhr.weapp.js +0 -1
  75. package/lib/node/uuid.js +0 -1
  76. package/lib/react-native/CoreManager.js +2 -2
  77. package/lib/react-native/CryptoController.js +0 -1
  78. package/lib/react-native/EventEmitter.js +0 -1
  79. package/lib/react-native/EventuallyQueue.js +5 -9
  80. package/lib/react-native/IndexedDBStorageController.js +0 -1
  81. package/lib/react-native/InstallationController.js +0 -1
  82. package/lib/react-native/LiveQuerySubscription.js +7 -7
  83. package/lib/react-native/LocalDatastore.js +0 -1
  84. package/lib/react-native/LocalDatastoreController.default.js +0 -1
  85. package/lib/react-native/LocalDatastoreController.js +0 -1
  86. package/lib/react-native/LocalDatastoreController.react-native.js +0 -1
  87. package/lib/react-native/OfflineQuery.js +0 -1
  88. package/lib/react-native/Parse.js +8 -1
  89. package/lib/react-native/ParseConfig.js +2 -4
  90. package/lib/react-native/ParseInstallation.js +0 -1
  91. package/lib/react-native/ParseLiveQuery.js +2 -2
  92. package/lib/react-native/ParseObject.js +16 -18
  93. package/lib/react-native/ParseQuery.js +5 -6
  94. package/lib/react-native/ParseSchema.js +5 -6
  95. package/lib/react-native/ParseUser.js +3 -5
  96. package/lib/react-native/RESTController.js +3 -1
  97. package/lib/react-native/Socket.weapp.js +0 -1
  98. package/lib/react-native/Storage.js +0 -1
  99. package/lib/react-native/StorageController.browser.js +0 -1
  100. package/lib/react-native/StorageController.default.js +0 -1
  101. package/lib/react-native/StorageController.js +0 -1
  102. package/lib/react-native/StorageController.react-native.js +0 -1
  103. package/lib/react-native/StorageController.weapp.js +0 -1
  104. package/lib/react-native/TaskQueue.js +0 -1
  105. package/lib/react-native/WebSocketController.js +0 -1
  106. package/lib/react-native/Xhr.weapp.js +0 -1
  107. package/lib/react-native/uuid.js +0 -1
  108. package/lib/weapp/Cloud.js +1 -0
  109. package/lib/weapp/CoreManager.js +2 -2
  110. package/lib/weapp/CryptoController.js +0 -1
  111. package/lib/weapp/EventEmitter.js +0 -1
  112. package/lib/weapp/EventuallyQueue.js +6 -10
  113. package/lib/weapp/IndexedDBStorageController.js +0 -1
  114. package/lib/weapp/InstallationController.js +0 -1
  115. package/lib/weapp/LiveQuerySubscription.js +4 -4
  116. package/lib/weapp/LocalDatastore.js +0 -1
  117. package/lib/weapp/LocalDatastoreController.default.js +0 -1
  118. package/lib/weapp/LocalDatastoreController.js +0 -1
  119. package/lib/weapp/LocalDatastoreController.react-native.js +0 -1
  120. package/lib/weapp/OfflineQuery.js +0 -1
  121. package/lib/weapp/Parse.js +12 -1
  122. package/lib/weapp/ParseACL.js +1 -1
  123. package/lib/weapp/ParseConfig.js +2 -4
  124. package/lib/weapp/ParseInstallation.js +0 -1
  125. package/lib/weapp/ParseLiveQuery.js +2 -2
  126. package/lib/weapp/ParseObject.js +10 -10
  127. package/lib/weapp/ParseQuery.js +26 -25
  128. package/lib/weapp/ParseRole.js +1 -1
  129. package/lib/weapp/ParseSchema.js +6 -6
  130. package/lib/weapp/ParseUser.js +10 -12
  131. package/lib/weapp/RESTController.js +7 -3
  132. package/lib/weapp/Socket.weapp.js +0 -1
  133. package/lib/weapp/Storage.js +0 -1
  134. package/lib/weapp/StorageController.browser.js +0 -1
  135. package/lib/weapp/StorageController.default.js +0 -1
  136. package/lib/weapp/StorageController.js +0 -1
  137. package/lib/weapp/StorageController.react-native.js +0 -1
  138. package/lib/weapp/StorageController.weapp.js +0 -1
  139. package/lib/weapp/TaskQueue.js +0 -1
  140. package/lib/weapp/WebSocketController.js +0 -1
  141. package/lib/weapp/Xhr.weapp.js +0 -1
  142. package/lib/weapp/uuid.js +0 -1
  143. package/package.json +15 -12
  144. package/types/Analytics.d.ts +42 -0
  145. package/types/AnonymousUtils.d.ts +84 -0
  146. package/types/Cloud.d.ts +65 -0
  147. package/types/CloudCode.d.ts +307 -0
  148. package/types/CoreManager.d.ts +325 -0
  149. package/types/CryptoController.d.ts +5 -0
  150. package/types/EventEmitter.d.ts +5 -0
  151. package/types/EventuallyQueue.d.ts +168 -0
  152. package/types/FacebookUtils.d.ts +107 -0
  153. package/types/IndexedDBStorageController.d.ts +2 -0
  154. package/types/InstallationController.d.ts +10 -0
  155. package/types/LiveQueryClient.d.ts +128 -0
  156. package/types/LiveQuerySubscription.d.ts +103 -0
  157. package/types/LocalDatastore.d.ts +56 -0
  158. package/types/LocalDatastoreController.d.ts +2 -0
  159. package/types/LocalDatastoreController.default.d.ts +9 -0
  160. package/types/LocalDatastoreController.react-native.d.ts +9 -0
  161. package/types/LocalDatastoreUtils.d.ts +5 -0
  162. package/types/ObjectStateMutations.d.ts +28 -0
  163. package/types/OfflineQuery.d.ts +20 -0
  164. package/types/Parse.d.ts +633 -0
  165. package/types/ParseACL.d.ts +141 -0
  166. package/types/ParseCLP.d.ts +293 -0
  167. package/types/ParseConfig.d.ts +77 -0
  168. package/types/ParseError.d.ts +476 -0
  169. package/types/ParseFile.d.ts +192 -0
  170. package/types/ParseGeoPoint.d.ts +104 -0
  171. package/types/ParseHooks.d.ts +27 -0
  172. package/types/ParseInstallation.d.ts +179 -0
  173. package/types/ParseLiveQuery.d.ts +48 -0
  174. package/types/ParseObject.d.ts +1072 -0
  175. package/types/ParseOp.d.ts +78 -0
  176. package/types/ParsePolygon.d.ts +69 -0
  177. package/types/ParseQuery.d.ts +961 -0
  178. package/types/ParseRelation.d.ts +56 -0
  179. package/types/ParseRole.d.ts +79 -0
  180. package/types/ParseSchema.d.ts +286 -0
  181. package/types/ParseSession.d.ts +45 -0
  182. package/types/ParseUser.d.ts +517 -0
  183. package/types/Push.d.ts +62 -0
  184. package/types/RESTController.d.ts +35 -0
  185. package/types/SingleInstanceStateController.d.ts +24 -0
  186. package/types/Socket.weapp.d.ts +10 -0
  187. package/types/Storage.d.ts +14 -0
  188. package/types/StorageController.browser.d.ts +9 -0
  189. package/types/StorageController.d.ts +2 -0
  190. package/types/StorageController.default.d.ts +9 -0
  191. package/types/StorageController.react-native.d.ts +11 -0
  192. package/types/StorageController.weapp.d.ts +9 -0
  193. package/types/TaskQueue.d.ts +11 -0
  194. package/types/UniqueInstanceStateController.d.ts +20 -0
  195. package/types/WebSocketController.d.ts +2 -0
  196. package/types/Xhr.weapp.d.ts +29 -0
  197. package/types/arrayContainsObject.d.ts +2 -0
  198. package/types/canBeSerialized.d.ts +2 -0
  199. package/types/decode.d.ts +1 -0
  200. package/types/encode.d.ts +1 -0
  201. package/types/equals.d.ts +1 -0
  202. package/types/escape.d.ts +1 -0
  203. package/types/index.d.ts +66 -0
  204. package/types/isRevocableSession.d.ts +1 -0
  205. package/types/node.d.ts +3 -0
  206. package/types/parseDate.d.ts +1 -0
  207. package/types/promiseUtils.d.ts +9 -0
  208. package/types/react-native.d.ts +3 -0
  209. package/types/tests.ts +2256 -0
  210. package/types/tsconfig.json +25 -0
  211. package/types/unique.d.ts +1 -0
  212. package/types/unsavedChildren.d.ts +11 -0
  213. package/types/uuid.d.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parse",
3
- "version": "6.1.0-alpha.1",
3
+ "version": "6.1.0-alpha.3",
4
4
  "description": "Parse JavaScript SDK",
5
5
  "homepage": "https://parseplatform.org",
6
6
  "keywords": [
@@ -21,15 +21,17 @@
21
21
  "weapp.js",
22
22
  "dist/",
23
23
  "lib/",
24
+ "types/",
24
25
  "LICENSE",
25
26
  "NOTICE",
26
27
  "README.md"
27
28
  ],
29
+ "types": "types/index.d.ts",
28
30
  "browser": {
29
31
  "react-native": false
30
32
  },
31
33
  "dependencies": {
32
- "@babel/runtime-corejs3": "7.26.9",
34
+ "@babel/runtime-corejs3": "7.26.10",
33
35
  "idb-keyval": "6.2.1",
34
36
  "react-native-crypto-js": "1.0.0",
35
37
  "uuid": "10.0.0",
@@ -37,13 +39,13 @@
37
39
  "xmlhttprequest": "1.8.0"
38
40
  },
39
41
  "devDependencies": {
40
- "@babel/core": "7.26.9",
42
+ "@babel/core": "7.26.10",
41
43
  "@babel/plugin-proposal-class-properties": "7.18.6",
42
- "@babel/plugin-transform-runtime": "7.26.9",
44
+ "@babel/plugin-transform-runtime": "7.26.10",
43
45
  "@babel/preset-env": "7.26.9",
44
46
  "@babel/preset-react": "7.26.3",
45
47
  "@babel/preset-typescript": "7.26.0",
46
- "@eslint/js": "9.18.0",
48
+ "@eslint/js": "9.22.0",
47
49
  "@parse/minami": "git+https://github.com/parse-community/minami#main",
48
50
  "@saithodev/semantic-release-backmerge": "4.0.1",
49
51
  "@semantic-release/changelog": "6.0.3",
@@ -61,9 +63,9 @@
61
63
  "codecov": "3.8.3",
62
64
  "core-js": "3.41.0",
63
65
  "cross-env": "7.0.2",
64
- "eslint": "9.21.0",
66
+ "eslint": "9.22.0",
65
67
  "eslint-plugin-expect-type": "0.6.2",
66
- "eslint-plugin-jsdoc": "50.6.3",
68
+ "eslint-plugin-jsdoc": "50.6.6",
67
69
  "express": "4.21.2",
68
70
  "gulp": "5.0.0",
69
71
  "gulp-babel": "8.0.0",
@@ -80,16 +82,16 @@
80
82
  "jest-environment-jsdom": "29.7.0",
81
83
  "jsdoc": "4.0.4",
82
84
  "jsdoc-babel": "0.5.0",
83
- "lint-staged": "15.4.3",
85
+ "lint-staged": "15.5.0",
84
86
  "madge": "8.0.0",
85
87
  "metro-react-native-babel-preset": "0.77.0",
86
88
  "mongodb-runner": "5.8.0",
87
89
  "parse-server": "7.3.0",
88
90
  "prettier": "3.5.2",
89
- "puppeteer": "24.2.1",
91
+ "puppeteer": "24.4.0",
90
92
  "regenerator-runtime": "0.14.1",
91
93
  "semantic-release": "24.2.3",
92
- "typescript-eslint": "8.25.0",
94
+ "typescript-eslint": "8.26.0",
93
95
  "vinyl-source-stream": "2.0.0"
94
96
  },
95
97
  "optionalDependencies": {
@@ -97,7 +99,7 @@
97
99
  },
98
100
  "scripts": {
99
101
  "build": "node build_releases.js",
100
- "build:types": "tsc && prettier --write 'types/{**/*,*}.ts'",
102
+ "build:types": "tsc",
101
103
  "ci:typecheck": "node ./ci/typecheck.js",
102
104
  "release": "node build_releases.js && npm publish",
103
105
  "test": "cross-env PARSE_BUILD=node jest",
@@ -106,11 +108,12 @@
106
108
  "posttest:mongodb": "mongodb-runner stop --all",
107
109
  "lint": "eslint --cache src/ integration/",
108
110
  "lint:fix": "eslint --fix --cache src/ integration/",
109
- "test:types": "eslint --cache types/tests.ts -c eslint.config.test.mjs",
111
+ "test:types": "eslint types/tests.ts -c eslint.config.test.mjs",
110
112
  "watch": "cross-env PARSE_BUILD=${PARSE_BUILD} gulp watch",
111
113
  "watch:browser": "cross-env PARSE_BUILD=browser npm run watch",
112
114
  "watch:node": "cross-env PARSE_BUILD=node npm run watch",
113
115
  "watch:react-native": "cross-env PARSE_BUILD=react-native npm run watch",
116
+ "watch:ts": "tsc --watch",
114
117
  "integration": "cross-env TESTING=1 jasmine --config=jasmine.json",
115
118
  "docs": "jsdoc -c ./jsdoc-conf.json ./src",
116
119
  "madge:circular": "madge ./src --extensions js,ts --circular",
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Parse.Analytics provides an interface to Parse's logging and analytics
3
+ * backend.
4
+ *
5
+ * @class Parse.Analytics
6
+ * @static
7
+ * @hideconstructor
8
+ */
9
+ /**
10
+ * Tracks the occurrence of a custom event with additional dimensions.
11
+ * Parse will store a data point at the time of invocation with the given
12
+ * event name.
13
+ *
14
+ * Dimensions will allow segmentation of the occurrences of this custom
15
+ * event. Keys and values should be {@code String}s, and will throw
16
+ * otherwise.
17
+ *
18
+ * To track a user signup along with additional metadata, consider the
19
+ * following:
20
+ * <pre>
21
+ * var dimensions = {
22
+ * gender: 'm',
23
+ * source: 'web',
24
+ * dayType: 'weekend'
25
+ * };
26
+ * Parse.Analytics.track('signup', dimensions);
27
+ * </pre>
28
+ *
29
+ * There is a default limit of 8 dimensions per event tracked.
30
+ *
31
+ * @function track
32
+ * @name Parse.Analytics.track
33
+ * @param {string} name The name of the custom event to report to Parse as
34
+ * having happened.
35
+ * @param {object} dimensions The dictionary of information by which to
36
+ * segment this event.
37
+ * @returns {Promise} A promise that is resolved when the round-trip
38
+ * to the server completes.
39
+ */
40
+ export declare function track(name: string, dimensions: {
41
+ [key: string]: string;
42
+ }): Promise<void>;
@@ -0,0 +1,84 @@
1
+ import ParseUser from './ParseUser';
2
+ import type { RequestOptions } from './RESTController';
3
+ /**
4
+ * Provides utility functions for working with Anonymously logged-in users. <br />
5
+ * Anonymous users have some unique characteristics:
6
+ * <ul>
7
+ * <li>Anonymous users don't need a user name or password.</li>
8
+ * <ul>
9
+ * <li>Once logged out, an anonymous user cannot be recovered.</li>
10
+ * </ul>
11
+ * <li>signUp converts an anonymous user to a standard user with the given username and password.</li>
12
+ * <ul>
13
+ * <li>Data associated with the anonymous user is retained.</li>
14
+ * </ul>
15
+ * <li>logIn switches users without converting the anonymous user.</li>
16
+ * <ul>
17
+ * <li>Data associated with the anonymous user will be lost.</li>
18
+ * </ul>
19
+ * <li>Service logIn (e.g. Facebook, Twitter) will attempt to convert
20
+ * the anonymous user into a standard user by linking it to the service.</li>
21
+ * <ul>
22
+ * <li>If a user already exists that is linked to the service, it will instead switch to the existing user.</li>
23
+ * </ul>
24
+ * <li>Service linking (e.g. Facebook, Twitter) will convert the anonymous user
25
+ * into a standard user by linking it to the service.</li>
26
+ * </ul>
27
+ *
28
+ * @class Parse.AnonymousUtils
29
+ * @static
30
+ */
31
+ declare const AnonymousUtils: {
32
+ /**
33
+ * Gets whether the user has their account linked to anonymous user.
34
+ *
35
+ * @function isLinked
36
+ * @name Parse.AnonymousUtils.isLinked
37
+ * @param {Parse.User} user User to check for.
38
+ * The user must be logged in on this device.
39
+ * @returns {boolean} <code>true</code> if the user has their account
40
+ * linked to an anonymous user.
41
+ * @static
42
+ */
43
+ isLinked(user: ParseUser): boolean;
44
+ /**
45
+ * Logs in a user Anonymously.
46
+ *
47
+ * @function logIn
48
+ * @name Parse.AnonymousUtils.logIn
49
+ * @param {object} options MasterKey / SessionToken.
50
+ * @returns {Promise} Logged in user
51
+ * @static
52
+ */
53
+ logIn(options?: RequestOptions): Promise<ParseUser>;
54
+ /**
55
+ * Links Anonymous User to an existing PFUser.
56
+ *
57
+ * @function link
58
+ * @name Parse.AnonymousUtils.link
59
+ * @param {Parse.User} user User to link. This must be the current user.
60
+ * @param {object} options MasterKey / SessionToken.
61
+ * @returns {Promise} Linked with User
62
+ * @static
63
+ */
64
+ link(user: ParseUser, options?: RequestOptions): Promise<ParseUser>;
65
+ /**
66
+ * Returns true if Authentication Provider has been registered for use.
67
+ *
68
+ * @function isRegistered
69
+ * @name Parse.AnonymousUtils.isRegistered
70
+ * @returns {boolean}
71
+ * @static
72
+ */
73
+ isRegistered(): boolean;
74
+ _getAuthProvider(): {
75
+ restoreAuthentication(): boolean;
76
+ getAuthType(): string;
77
+ getAuthData(): {
78
+ authData: {
79
+ id: string;
80
+ };
81
+ };
82
+ };
83
+ };
84
+ export default AnonymousUtils;
@@ -0,0 +1,65 @@
1
+ import ParseObject from './ParseObject';
2
+ import type { RequestOptions } from './RESTController';
3
+ /**
4
+ * Contains functions for calling and declaring
5
+ * <a href="/docs/cloud_code_guide#functions">cloud functions</a>.
6
+ * <p><strong><em>
7
+ * Some functions are only available from Cloud Code.
8
+ * </em></strong></p>
9
+ *
10
+ * @class Parse.Cloud
11
+ * @static
12
+ * @hideconstructor
13
+ */
14
+ /**
15
+ * Makes a call to a cloud function.
16
+ *
17
+ * @function run
18
+ * @name Parse.Cloud.run
19
+ * @param {string} name The function name.
20
+ * @param {object} data The parameters to send to the cloud function.
21
+ * @param {object} options
22
+ * Valid options are:<ul>
23
+ * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
24
+ * be used for this request.
25
+ * <li>sessionToken: A valid session token, used for making a request on
26
+ * behalf of a specific user.
27
+ * <li>installationId: the installationId which made the request
28
+ * <li>context: A dictionary that is accessible in Cloud Code triggers.
29
+ * </ul>
30
+ * @returns {Promise} A promise that will be resolved with the result
31
+ * of the function.
32
+ */
33
+ export declare function run<T extends () => any>(name: string, data?: null, options?: RequestOptions): Promise<ReturnType<T>>;
34
+ export declare function run<T extends (param: {
35
+ [P in keyof Parameters<T>[0]]: Parameters<T>[0][P];
36
+ }) => any>(name: string, data: Parameters<T>[0], options?: RequestOptions): Promise<ReturnType<T>>;
37
+ /**
38
+ * Gets data for the current set of cloud jobs.
39
+ *
40
+ * @function getJobsData
41
+ * @name Parse.Cloud.getJobsData
42
+ * @returns {Promise} A promise that will be resolved with the result
43
+ * of the function.
44
+ */
45
+ export declare function getJobsData(): Promise<any>;
46
+ /**
47
+ * Starts a given cloud job, which will process asynchronously.
48
+ *
49
+ * @function startJob
50
+ * @name Parse.Cloud.startJob
51
+ * @param {string} name The function name.
52
+ * @param {object} data The parameters to send to the cloud function.
53
+ * @returns {Promise} A promise that will be resolved with the jobStatusId
54
+ * of the job.
55
+ */
56
+ export declare function startJob(name: string, data: any): Promise<string>;
57
+ /**
58
+ * Gets job status by Id
59
+ *
60
+ * @function getJobStatus
61
+ * @name Parse.Cloud.getJobStatus
62
+ * @param {string} jobStatusId The Id of Job Status.
63
+ * @returns {Parse.Object} Status of Job.
64
+ */
65
+ export declare function getJobStatus(jobStatusId: string): Promise<ParseObject>;
@@ -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
+ */