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.
- package/README.md +0 -8
- package/dist/parse.js +27 -47
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +27 -47
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +1 -2
- package/lib/browser/CryptoController.js +0 -1
- package/lib/browser/EventEmitter.js +0 -1
- package/lib/browser/EventuallyQueue.js +0 -1
- package/lib/browser/IndexedDBStorageController.js +0 -1
- package/lib/browser/InstallationController.js +0 -1
- package/lib/browser/LocalDatastore.js +0 -1
- package/lib/browser/LocalDatastoreController.default.js +0 -1
- package/lib/browser/LocalDatastoreController.js +0 -1
- package/lib/browser/LocalDatastoreController.react-native.js +0 -1
- package/lib/browser/OfflineQuery.js +0 -1
- package/lib/browser/ParseInstallation.js +0 -1
- package/lib/browser/ParseQuery.js +19 -17
- package/lib/browser/RESTController.js +4 -3
- package/lib/browser/Socket.weapp.js +0 -1
- package/lib/browser/Storage.js +0 -1
- package/lib/browser/StorageController.browser.js +0 -1
- package/lib/browser/StorageController.default.js +0 -1
- package/lib/browser/StorageController.js +0 -1
- package/lib/browser/StorageController.react-native.js +0 -1
- package/lib/browser/StorageController.weapp.js +0 -1
- package/lib/browser/TaskQueue.js +0 -1
- package/lib/browser/WebSocketController.js +0 -1
- package/lib/browser/Xhr.weapp.js +0 -1
- package/lib/browser/uuid.js +0 -1
- package/lib/node/CoreManager.js +1 -2
- package/lib/node/CryptoController.js +0 -1
- package/lib/node/EventEmitter.js +0 -1
- package/lib/node/EventuallyQueue.js +0 -1
- package/lib/node/IndexedDBStorageController.js +0 -1
- package/lib/node/InstallationController.js +0 -1
- package/lib/node/LocalDatastore.js +0 -1
- package/lib/node/LocalDatastoreController.default.js +0 -1
- package/lib/node/LocalDatastoreController.js +0 -1
- package/lib/node/LocalDatastoreController.react-native.js +0 -1
- package/lib/node/OfflineQuery.js +0 -1
- package/lib/node/ParseInstallation.js +0 -1
- package/lib/node/RESTController.js +0 -1
- package/lib/node/Socket.weapp.js +0 -1
- package/lib/node/Storage.js +0 -1
- package/lib/node/StorageController.browser.js +0 -1
- package/lib/node/StorageController.default.js +0 -1
- package/lib/node/StorageController.js +0 -1
- package/lib/node/StorageController.react-native.js +0 -1
- package/lib/node/StorageController.weapp.js +0 -1
- package/lib/node/TaskQueue.js +0 -1
- package/lib/node/WebSocketController.js +0 -1
- package/lib/node/Xhr.weapp.js +0 -1
- package/lib/node/uuid.js +0 -1
- package/lib/react-native/CoreManager.js +1 -2
- package/lib/react-native/CryptoController.js +0 -1
- package/lib/react-native/EventEmitter.js +0 -1
- package/lib/react-native/EventuallyQueue.js +0 -1
- package/lib/react-native/IndexedDBStorageController.js +0 -1
- package/lib/react-native/InstallationController.js +0 -1
- package/lib/react-native/LocalDatastore.js +0 -1
- package/lib/react-native/LocalDatastoreController.default.js +0 -1
- package/lib/react-native/LocalDatastoreController.js +0 -1
- package/lib/react-native/LocalDatastoreController.react-native.js +0 -1
- package/lib/react-native/OfflineQuery.js +0 -1
- package/lib/react-native/ParseInstallation.js +0 -1
- package/lib/react-native/RESTController.js +0 -1
- package/lib/react-native/Socket.weapp.js +0 -1
- package/lib/react-native/Storage.js +0 -1
- package/lib/react-native/StorageController.browser.js +0 -1
- package/lib/react-native/StorageController.default.js +0 -1
- package/lib/react-native/StorageController.js +0 -1
- package/lib/react-native/StorageController.react-native.js +0 -1
- package/lib/react-native/StorageController.weapp.js +0 -1
- package/lib/react-native/TaskQueue.js +0 -1
- package/lib/react-native/WebSocketController.js +0 -1
- package/lib/react-native/Xhr.weapp.js +0 -1
- package/lib/react-native/uuid.js +0 -1
- package/lib/weapp/CoreManager.js +1 -2
- package/lib/weapp/CryptoController.js +0 -1
- package/lib/weapp/EventEmitter.js +0 -1
- package/lib/weapp/EventuallyQueue.js +0 -1
- package/lib/weapp/IndexedDBStorageController.js +0 -1
- package/lib/weapp/InstallationController.js +0 -1
- package/lib/weapp/LocalDatastore.js +0 -1
- package/lib/weapp/LocalDatastoreController.default.js +0 -1
- package/lib/weapp/LocalDatastoreController.js +0 -1
- package/lib/weapp/LocalDatastoreController.react-native.js +0 -1
- package/lib/weapp/OfflineQuery.js +0 -1
- package/lib/weapp/ParseInstallation.js +0 -1
- package/lib/weapp/ParseQuery.js +19 -17
- package/lib/weapp/RESTController.js +4 -3
- package/lib/weapp/Socket.weapp.js +0 -1
- package/lib/weapp/Storage.js +0 -1
- package/lib/weapp/StorageController.browser.js +0 -1
- package/lib/weapp/StorageController.default.js +0 -1
- package/lib/weapp/StorageController.js +0 -1
- package/lib/weapp/StorageController.react-native.js +0 -1
- package/lib/weapp/StorageController.weapp.js +0 -1
- package/lib/weapp/TaskQueue.js +0 -1
- package/lib/weapp/WebSocketController.js +0 -1
- package/lib/weapp/Xhr.weapp.js +0 -1
- package/lib/weapp/uuid.js +0 -1
- package/package.json +11 -9
- package/types/Analytics.d.ts +42 -0
- package/types/AnonymousUtils.d.ts +84 -0
- package/types/Cloud.d.ts +65 -0
- package/types/CloudCode.d.ts +307 -0
- package/types/CoreManager.d.ts +325 -0
- package/types/CryptoController.d.ts +5 -0
- package/types/EventEmitter.d.ts +5 -0
- package/types/EventuallyQueue.d.ts +168 -0
- package/types/FacebookUtils.d.ts +107 -0
- package/types/IndexedDBStorageController.d.ts +2 -0
- package/types/InstallationController.d.ts +10 -0
- package/types/LiveQueryClient.d.ts +128 -0
- package/types/LiveQuerySubscription.d.ts +103 -0
- package/types/LocalDatastore.d.ts +56 -0
- package/types/LocalDatastoreController.d.ts +2 -0
- package/types/LocalDatastoreController.default.d.ts +9 -0
- package/types/LocalDatastoreController.react-native.d.ts +9 -0
- package/types/LocalDatastoreUtils.d.ts +5 -0
- package/types/ObjectStateMutations.d.ts +28 -0
- package/types/OfflineQuery.d.ts +20 -0
- package/types/Parse.d.ts +633 -0
- package/types/ParseACL.d.ts +141 -0
- package/types/ParseCLP.d.ts +293 -0
- package/types/ParseConfig.d.ts +77 -0
- package/types/ParseError.d.ts +476 -0
- package/types/ParseFile.d.ts +192 -0
- package/types/ParseGeoPoint.d.ts +104 -0
- package/types/ParseHooks.d.ts +27 -0
- package/types/ParseInstallation.d.ts +179 -0
- package/types/ParseLiveQuery.d.ts +48 -0
- package/types/ParseObject.d.ts +1072 -0
- package/types/ParseOp.d.ts +78 -0
- package/types/ParsePolygon.d.ts +69 -0
- package/types/ParseQuery.d.ts +961 -0
- package/types/ParseRelation.d.ts +56 -0
- package/types/ParseRole.d.ts +79 -0
- package/types/ParseSchema.d.ts +286 -0
- package/types/ParseSession.d.ts +45 -0
- package/types/ParseUser.d.ts +517 -0
- package/types/Push.d.ts +62 -0
- package/types/RESTController.d.ts +35 -0
- package/types/SingleInstanceStateController.d.ts +24 -0
- package/types/Socket.weapp.d.ts +10 -0
- package/types/Storage.d.ts +14 -0
- package/types/StorageController.browser.d.ts +9 -0
- package/types/StorageController.d.ts +2 -0
- package/types/StorageController.default.d.ts +9 -0
- package/types/StorageController.react-native.d.ts +11 -0
- package/types/StorageController.weapp.d.ts +9 -0
- package/types/TaskQueue.d.ts +11 -0
- package/types/UniqueInstanceStateController.d.ts +20 -0
- package/types/WebSocketController.d.ts +2 -0
- package/types/Xhr.weapp.d.ts +29 -0
- package/types/arrayContainsObject.d.ts +2 -0
- package/types/canBeSerialized.d.ts +2 -0
- package/types/decode.d.ts +1 -0
- package/types/encode.d.ts +1 -0
- package/types/equals.d.ts +1 -0
- package/types/escape.d.ts +1 -0
- package/types/index.d.ts +66 -0
- package/types/isRevocableSession.d.ts +1 -0
- package/types/node.d.ts +3 -0
- package/types/parseDate.d.ts +1 -0
- package/types/promiseUtils.d.ts +9 -0
- package/types/react-native.d.ts +3 -0
- package/types/tests.ts +2256 -0
- package/types/tsconfig.json +25 -0
- package/types/unique.d.ts +1 -0
- package/types/unsavedChildren.d.ts +11 -0
- package/types/uuid.d.ts +2 -0
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
import ParseObject, { Attributes } from './ParseObject';
|
|
2
|
+
import type { RequestOptions, FullOptions } from './RESTController';
|
|
3
|
+
export type AuthData = {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
};
|
|
6
|
+
export type AuthProvider = {
|
|
7
|
+
authenticate?(options: {
|
|
8
|
+
error?: (provider: AuthProvider, error: string | any) => void;
|
|
9
|
+
success?: (provider: AuthProvider, result: AuthData) => void;
|
|
10
|
+
}): void;
|
|
11
|
+
restoreAuthentication(authData: any): boolean;
|
|
12
|
+
getAuthType(): string;
|
|
13
|
+
deauthenticate?(): void;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* <p>A Parse.User object is a local representation of a user persisted to the
|
|
17
|
+
* Parse cloud. This class is a subclass of a Parse.Object, and retains the
|
|
18
|
+
* same functionality of a Parse.Object, but also extends it with various
|
|
19
|
+
* user specific methods, like authentication, signing up, and validation of
|
|
20
|
+
* uniqueness.</p>
|
|
21
|
+
*
|
|
22
|
+
* @alias Parse.User
|
|
23
|
+
* @augments Parse.Object
|
|
24
|
+
*/
|
|
25
|
+
declare class ParseUser<T extends Attributes = Attributes> extends ParseObject<T> {
|
|
26
|
+
/**
|
|
27
|
+
* @param {object} attributes The initial set of data to store in the user.
|
|
28
|
+
*/
|
|
29
|
+
constructor(attributes?: T);
|
|
30
|
+
/**
|
|
31
|
+
* Request a revocable session token to replace the older style of token.
|
|
32
|
+
*
|
|
33
|
+
* @param {object} options
|
|
34
|
+
* Valid options are:<ul>
|
|
35
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
36
|
+
* be used for this request.
|
|
37
|
+
* </ul>
|
|
38
|
+
* @returns {Promise} A promise that is resolved when the replacement
|
|
39
|
+
* token has been fetched.
|
|
40
|
+
*/
|
|
41
|
+
_upgradeToRevocableSession(options?: RequestOptions): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Parse allows you to link your users with {@link https://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication 3rd party authentication}, enabling
|
|
44
|
+
* your users to sign up or log into your application using their existing identities.
|
|
45
|
+
* Since 2.9.0
|
|
46
|
+
*
|
|
47
|
+
* @see {@link https://docs.parseplatform.org/js/guide/#linking-users Linking Users}
|
|
48
|
+
* @param {string | AuthProvider} provider Name of auth provider or {@link https://parseplatform.org/Parse-SDK-JS/api/master/AuthProvider.html AuthProvider}
|
|
49
|
+
* @param {object} options
|
|
50
|
+
* @param {object} [options.authData] AuthData to link with
|
|
51
|
+
* <ul>
|
|
52
|
+
* <li>If provider is string, options is {@link http://docs.parseplatform.org/parse-server/guide/#supported-3rd-party-authentications authData}
|
|
53
|
+
* <li>If provider is AuthProvider, options is saveOpts
|
|
54
|
+
* </ul>
|
|
55
|
+
* @param {object} saveOpts useMasterKey / sessionToken
|
|
56
|
+
* @returns {Promise} A promise that is fulfilled with the user is linked
|
|
57
|
+
*/
|
|
58
|
+
linkWith(provider: string | AuthProvider, options: {
|
|
59
|
+
authData?: AuthData;
|
|
60
|
+
}, saveOpts?: FullOptions): Promise<ParseUser>;
|
|
61
|
+
/**
|
|
62
|
+
* @param provider
|
|
63
|
+
* @param options
|
|
64
|
+
* @param {object} [options.authData]
|
|
65
|
+
* @param saveOpts
|
|
66
|
+
* @deprecated since 2.9.0 see {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith}
|
|
67
|
+
* @returns {Promise}
|
|
68
|
+
*/
|
|
69
|
+
_linkWith(provider: any, options: {
|
|
70
|
+
authData?: AuthData;
|
|
71
|
+
}, saveOpts?: FullOptions): Promise<ParseUser>;
|
|
72
|
+
/**
|
|
73
|
+
* Synchronizes auth data for a provider (e.g. puts the access token in the
|
|
74
|
+
* right place to be used by the Facebook SDK).
|
|
75
|
+
*
|
|
76
|
+
* @param provider
|
|
77
|
+
*/
|
|
78
|
+
_synchronizeAuthData(provider: string | AuthProvider): void;
|
|
79
|
+
/**
|
|
80
|
+
* Synchronizes authData for all providers.
|
|
81
|
+
*/
|
|
82
|
+
_synchronizeAllAuthData(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Removes null values from authData (which exist temporarily for unlinking)
|
|
85
|
+
*/
|
|
86
|
+
_cleanupAuthData(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Unlinks a user from a service.
|
|
89
|
+
*
|
|
90
|
+
* @param {string | AuthProvider} provider Name of auth provider or {@link https://parseplatform.org/Parse-SDK-JS/api/master/AuthProvider.html AuthProvider}
|
|
91
|
+
* @param {object} options MasterKey / SessionToken
|
|
92
|
+
* @returns {Promise} A promise that is fulfilled when the unlinking
|
|
93
|
+
* finishes.
|
|
94
|
+
*/
|
|
95
|
+
_unlinkFrom(provider: any, options?: FullOptions): Promise<ParseUser>;
|
|
96
|
+
/**
|
|
97
|
+
* Checks whether a user is linked to a service.
|
|
98
|
+
*
|
|
99
|
+
* @param {object} provider service to link to
|
|
100
|
+
* @returns {boolean} true if link was successful
|
|
101
|
+
*/
|
|
102
|
+
_isLinked(provider: any): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Deauthenticates all providers.
|
|
105
|
+
*/
|
|
106
|
+
_logOutWithAll(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Deauthenticates a single provider (e.g. removing access tokens from the
|
|
109
|
+
* Facebook SDK).
|
|
110
|
+
*
|
|
111
|
+
* @param {object} provider service to logout of
|
|
112
|
+
*/
|
|
113
|
+
_logOutWith(provider: any): void;
|
|
114
|
+
/**
|
|
115
|
+
* Class instance method used to maintain specific keys when a fetch occurs.
|
|
116
|
+
* Used to ensure that the session token is not lost.
|
|
117
|
+
*
|
|
118
|
+
* @returns {object} sessionToken
|
|
119
|
+
*/
|
|
120
|
+
_preserveFieldsOnFetch(): Attributes;
|
|
121
|
+
/**
|
|
122
|
+
* Returns true if <code>current</code> would return this user.
|
|
123
|
+
*
|
|
124
|
+
* @returns {boolean} true if user is cached on disk
|
|
125
|
+
*/
|
|
126
|
+
isCurrent(): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Returns true if <code>current</code> would return this user.
|
|
129
|
+
*
|
|
130
|
+
* @returns {Promise<boolean>} true if user is cached on disk
|
|
131
|
+
*/
|
|
132
|
+
isCurrentAsync(): Promise<boolean>;
|
|
133
|
+
stripAnonymity(): void;
|
|
134
|
+
restoreAnonimity(anonymousData: any): void;
|
|
135
|
+
/**
|
|
136
|
+
* Returns get("username").
|
|
137
|
+
*
|
|
138
|
+
* @returns {string}
|
|
139
|
+
*/
|
|
140
|
+
getUsername(): string | null;
|
|
141
|
+
/**
|
|
142
|
+
* Calls set("username", username, options) and returns the result.
|
|
143
|
+
*
|
|
144
|
+
* @param {string} username
|
|
145
|
+
*/
|
|
146
|
+
setUsername(username: string): void;
|
|
147
|
+
/**
|
|
148
|
+
* Calls set("password", password, options) and returns the result.
|
|
149
|
+
*
|
|
150
|
+
* @param {string} password User's Password
|
|
151
|
+
*/
|
|
152
|
+
setPassword(password: string): void;
|
|
153
|
+
/**
|
|
154
|
+
* Returns get("email").
|
|
155
|
+
*
|
|
156
|
+
* @returns {string} User's Email
|
|
157
|
+
*/
|
|
158
|
+
getEmail(): string | null;
|
|
159
|
+
/**
|
|
160
|
+
* Calls set("email", email) and returns the result.
|
|
161
|
+
*
|
|
162
|
+
* @param {string} email
|
|
163
|
+
* @returns {boolean}
|
|
164
|
+
*/
|
|
165
|
+
setEmail(email: string): this;
|
|
166
|
+
/**
|
|
167
|
+
* Returns the session token for this user, if the user has been logged in,
|
|
168
|
+
* or if it is the result of a query with the master key. Otherwise, returns
|
|
169
|
+
* undefined.
|
|
170
|
+
*
|
|
171
|
+
* @returns {string} the session token, or undefined
|
|
172
|
+
*/
|
|
173
|
+
getSessionToken(): string | null;
|
|
174
|
+
/**
|
|
175
|
+
* Checks whether this user is the current user and has been authenticated.
|
|
176
|
+
*
|
|
177
|
+
* @returns {boolean} whether this user is the current user and is logged in.
|
|
178
|
+
*/
|
|
179
|
+
authenticated(): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Signs up a new user. You should call this instead of save for
|
|
182
|
+
* new Parse.Users. This will create a new Parse.User on the server, and
|
|
183
|
+
* also persist the session on disk so that you can access the user using
|
|
184
|
+
* <code>current</code>.
|
|
185
|
+
*
|
|
186
|
+
* <p>A username and password must be set before calling signUp.</p>
|
|
187
|
+
*
|
|
188
|
+
* @param {object} attrs Extra fields to set on the new user, or null.
|
|
189
|
+
* @param {object} options
|
|
190
|
+
* Valid options are:<ul>
|
|
191
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
192
|
+
* be used for this request.
|
|
193
|
+
* <li>installationId: the installationId which made the request
|
|
194
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeLogin` and `afterLogin` triggers.
|
|
195
|
+
* </ul>
|
|
196
|
+
* @returns {Promise} A promise that is fulfilled when the signup
|
|
197
|
+
* finishes.
|
|
198
|
+
*/
|
|
199
|
+
signUp(attrs?: Attributes | null, options?: FullOptions & {
|
|
200
|
+
context?: Attributes;
|
|
201
|
+
}): Promise<ParseUser>;
|
|
202
|
+
/**
|
|
203
|
+
* Logs in a Parse.User. On success, this saves the session to disk,
|
|
204
|
+
* so you can retrieve the currently logged in user using
|
|
205
|
+
* <code>current</code>.
|
|
206
|
+
*
|
|
207
|
+
* <p>A username and password must be set before calling logIn.</p>
|
|
208
|
+
*
|
|
209
|
+
* @param {object} options
|
|
210
|
+
* Valid options are:<ul>
|
|
211
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
212
|
+
* be used for this request.
|
|
213
|
+
* <li>usePost: Use POST method to make the request (default: true)
|
|
214
|
+
* <li>installationId: the installationId which made the request
|
|
215
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeLogin` and `afterLogin` triggers.
|
|
216
|
+
* </ul>
|
|
217
|
+
* @returns {Promise} A promise that is fulfilled with the user when
|
|
218
|
+
* the login is complete.
|
|
219
|
+
*/
|
|
220
|
+
logIn(options?: FullOptions & {
|
|
221
|
+
context?: Attributes;
|
|
222
|
+
}): Promise<ParseUser>;
|
|
223
|
+
/**
|
|
224
|
+
* Wrap the default save behavior with functionality to save to local
|
|
225
|
+
* storage if this is current user.
|
|
226
|
+
*
|
|
227
|
+
* @param {...any} args
|
|
228
|
+
* @returns {Promise}
|
|
229
|
+
*/
|
|
230
|
+
save(...args: Array<any>): Promise<this>;
|
|
231
|
+
/**
|
|
232
|
+
* Wrap the default destroy behavior with functionality that logs out
|
|
233
|
+
* the current user when it is destroyed
|
|
234
|
+
*
|
|
235
|
+
* @param {...any} args
|
|
236
|
+
* @returns {Parse.User}
|
|
237
|
+
*/
|
|
238
|
+
destroy(...args: Array<any>): Promise<ParseUser | void>;
|
|
239
|
+
/**
|
|
240
|
+
* Wrap the default fetch behavior with functionality to save to local
|
|
241
|
+
* storage if this is current user.
|
|
242
|
+
*
|
|
243
|
+
* @param {...any} args
|
|
244
|
+
* @returns {Parse.User}
|
|
245
|
+
*/
|
|
246
|
+
fetch(...args: Array<any>): Promise<this>;
|
|
247
|
+
/**
|
|
248
|
+
* Wrap the default fetchWithInclude behavior with functionality to save to local
|
|
249
|
+
* storage if this is current user.
|
|
250
|
+
*
|
|
251
|
+
* @param {...any} args
|
|
252
|
+
* @returns {Parse.User}
|
|
253
|
+
*/
|
|
254
|
+
fetchWithInclude(...args: Array<any>): Promise<this>;
|
|
255
|
+
/**
|
|
256
|
+
* Verify whether a given password is the password of the current user.
|
|
257
|
+
*
|
|
258
|
+
* @param {string} password The password to be verified.
|
|
259
|
+
* @param {object} options The options.
|
|
260
|
+
* @param {boolean} [options.ignoreEmailVerification] Set to `true` to bypass email verification and verify
|
|
261
|
+
* the password regardless of whether the email has been verified. This requires the master key.
|
|
262
|
+
* @returns {Promise} A promise that is fulfilled with a user when the password is correct.
|
|
263
|
+
*/
|
|
264
|
+
verifyPassword(password: string, options?: RequestOptions): Promise<ParseUser>;
|
|
265
|
+
static readOnlyAttributes(): string[];
|
|
266
|
+
/**
|
|
267
|
+
* Adds functionality to the existing Parse.User class.
|
|
268
|
+
*
|
|
269
|
+
* @param {object} protoProps A set of properties to add to the prototype
|
|
270
|
+
* @param {object} classProps A set of static properties to add to the class
|
|
271
|
+
* @static
|
|
272
|
+
* @returns {Parse.User} The newly extended Parse.User class
|
|
273
|
+
*/
|
|
274
|
+
static extend(protoProps: {
|
|
275
|
+
[prop: string]: any;
|
|
276
|
+
}, classProps: {
|
|
277
|
+
[prop: string]: any;
|
|
278
|
+
}): typeof ParseUser;
|
|
279
|
+
/**
|
|
280
|
+
* Retrieves the currently logged in ParseUser with a valid session,
|
|
281
|
+
* either from memory or localStorage, if necessary.
|
|
282
|
+
*
|
|
283
|
+
* @static
|
|
284
|
+
* @returns {Parse.User} The currently logged in Parse.User.
|
|
285
|
+
*/
|
|
286
|
+
static current<T extends ParseUser>(): T | null;
|
|
287
|
+
/**
|
|
288
|
+
* Retrieves the currently logged in ParseUser from asynchronous Storage.
|
|
289
|
+
*
|
|
290
|
+
* @static
|
|
291
|
+
* @returns {Promise} A Promise that is resolved with the currently
|
|
292
|
+
* logged in Parse User
|
|
293
|
+
*/
|
|
294
|
+
static currentAsync<T extends ParseUser>(): Promise<T | null>;
|
|
295
|
+
/**
|
|
296
|
+
* Signs up a new user with a username (or email) and password.
|
|
297
|
+
* This will create a new Parse.User on the server, and also persist the
|
|
298
|
+
* session in localStorage so that you can access the user using
|
|
299
|
+
* {@link #current}.
|
|
300
|
+
*
|
|
301
|
+
* @param {string} username The username (or email) to sign up with.
|
|
302
|
+
* @param {string} password The password to sign up with.
|
|
303
|
+
* @param {object} attrs Extra fields to set on the new user.
|
|
304
|
+
* @param {object} options
|
|
305
|
+
* @static
|
|
306
|
+
* @returns {Promise} A promise that is fulfilled with the user when
|
|
307
|
+
* the signup completes.
|
|
308
|
+
*/
|
|
309
|
+
static signUp<T extends ParseUser>(username: string, password: string, attrs: Attributes, options?: FullOptions): Promise<T>;
|
|
310
|
+
/**
|
|
311
|
+
* Logs in a user with a username (or email) and password. On success, this
|
|
312
|
+
* saves the session to disk, so you can retrieve the currently logged in
|
|
313
|
+
* user using <code>current</code>.
|
|
314
|
+
*
|
|
315
|
+
* @param {string} username The username (or email) to log in with.
|
|
316
|
+
* @param {string} password The password to log in with.
|
|
317
|
+
* @param {object} options
|
|
318
|
+
* @static
|
|
319
|
+
* @returns {Promise} A promise that is fulfilled with the user when
|
|
320
|
+
* the login completes.
|
|
321
|
+
*/
|
|
322
|
+
static logIn<T extends ParseUser>(username: string, password: string, options?: FullOptions): Promise<T>;
|
|
323
|
+
/**
|
|
324
|
+
* Logs in a user with a username (or email) and password, and authData. On success, this
|
|
325
|
+
* saves the session to disk, so you can retrieve the currently logged in
|
|
326
|
+
* user using <code>current</code>.
|
|
327
|
+
*
|
|
328
|
+
* @param {string} username The username (or email) to log in with.
|
|
329
|
+
* @param {string} password The password to log in with.
|
|
330
|
+
* @param {object} authData The authData to log in with.
|
|
331
|
+
* @param {object} options
|
|
332
|
+
* @static
|
|
333
|
+
* @returns {Promise} A promise that is fulfilled with the user when
|
|
334
|
+
* the login completes.
|
|
335
|
+
*/
|
|
336
|
+
static logInWithAdditionalAuth<T extends ParseUser>(username: string, password: string, authData: AuthData, options?: FullOptions): Promise<T>;
|
|
337
|
+
/**
|
|
338
|
+
* Logs in a user with an objectId. On success, this saves the session
|
|
339
|
+
* to disk, so you can retrieve the currently logged in user using
|
|
340
|
+
* <code>current</code>.
|
|
341
|
+
*
|
|
342
|
+
* @param {string} userId The objectId for the user.
|
|
343
|
+
* @static
|
|
344
|
+
* @returns {Promise} A promise that is fulfilled with the user when
|
|
345
|
+
* the login completes.
|
|
346
|
+
*/
|
|
347
|
+
static loginAs<T extends ParseUser>(userId: string): Promise<T>;
|
|
348
|
+
/**
|
|
349
|
+
* Logs in a user with a session token. On success, this saves the session
|
|
350
|
+
* to disk, so you can retrieve the currently logged in user using
|
|
351
|
+
* <code>current</code>.
|
|
352
|
+
*
|
|
353
|
+
* @param {string} sessionToken The sessionToken to log in with.
|
|
354
|
+
* @param {object} options
|
|
355
|
+
* @param {boolean} [options.useMasterKey]
|
|
356
|
+
* @static
|
|
357
|
+
* @returns {Promise} A promise that is fulfilled with the user when
|
|
358
|
+
* the login completes.
|
|
359
|
+
*/
|
|
360
|
+
static become<T extends ParseUser>(sessionToken: string, options?: RequestOptions): Promise<T>;
|
|
361
|
+
/**
|
|
362
|
+
* Retrieves a user with a session token.
|
|
363
|
+
*
|
|
364
|
+
* @param {string} sessionToken The sessionToken to get user with.
|
|
365
|
+
* @param {object} options
|
|
366
|
+
* @param {boolean} [options.useMasterKey]
|
|
367
|
+
* @static
|
|
368
|
+
* @returns {Promise} A promise that is fulfilled with the user is fetched.
|
|
369
|
+
*/
|
|
370
|
+
static me<T extends ParseUser>(sessionToken: string, options?: RequestOptions): Promise<T>;
|
|
371
|
+
/**
|
|
372
|
+
* Logs in a user with a session token. On success, this saves the session
|
|
373
|
+
* to disk, so you can retrieve the currently logged in user using
|
|
374
|
+
* <code>current</code>. If there is no session token the user will not logged in.
|
|
375
|
+
*
|
|
376
|
+
* @param {object} userJSON The JSON map of the User's data
|
|
377
|
+
* @static
|
|
378
|
+
* @returns {Promise} A promise that is fulfilled with the user when
|
|
379
|
+
* the login completes.
|
|
380
|
+
*/
|
|
381
|
+
static hydrate<T extends ParseUser>(userJSON: Attributes): Promise<T>;
|
|
382
|
+
/**
|
|
383
|
+
* Static version of {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith}
|
|
384
|
+
*
|
|
385
|
+
* @param provider
|
|
386
|
+
* @param options
|
|
387
|
+
* @param {object} [options.authData]
|
|
388
|
+
* @param saveOpts
|
|
389
|
+
* @static
|
|
390
|
+
* @returns {Promise}
|
|
391
|
+
*/
|
|
392
|
+
static logInWith<T extends ParseUser>(provider: string | AuthProvider, options: {
|
|
393
|
+
authData?: AuthData;
|
|
394
|
+
}, saveOpts?: FullOptions): Promise<T>;
|
|
395
|
+
/**
|
|
396
|
+
* Logs out the currently logged in user session. This will remove the
|
|
397
|
+
* session from disk, log out of linked services, and future calls to
|
|
398
|
+
* <code>current</code> will return <code>null</code>.
|
|
399
|
+
*
|
|
400
|
+
* @param {object} options
|
|
401
|
+
* @static
|
|
402
|
+
* @returns {Promise} A promise that is resolved when the session is
|
|
403
|
+
* destroyed on the server.
|
|
404
|
+
*/
|
|
405
|
+
static logOut(options?: RequestOptions): Promise<void>;
|
|
406
|
+
/**
|
|
407
|
+
* Requests a password reset email to be sent to the specified email address
|
|
408
|
+
* associated with the user account. This email allows the user to securely
|
|
409
|
+
* reset their password on the Parse site.
|
|
410
|
+
*
|
|
411
|
+
* @param {string} email The email address associated with the user that
|
|
412
|
+
* forgot their password.
|
|
413
|
+
* @param {object} options
|
|
414
|
+
* Valid options are:<ul>
|
|
415
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
416
|
+
* be used for this request.
|
|
417
|
+
* </ul>
|
|
418
|
+
* @static
|
|
419
|
+
* @returns {Promise}
|
|
420
|
+
*/
|
|
421
|
+
static requestPasswordReset(email: string, options?: RequestOptions): Promise<void>;
|
|
422
|
+
/**
|
|
423
|
+
* Request an email verification.
|
|
424
|
+
*
|
|
425
|
+
* @param {string} email The email address associated with the user that
|
|
426
|
+
* needs to verify their email.
|
|
427
|
+
* @param {object} options
|
|
428
|
+
* Valid options are:<ul>
|
|
429
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
430
|
+
* be used for this request.
|
|
431
|
+
* </ul>
|
|
432
|
+
* @static
|
|
433
|
+
* @returns {Promise}
|
|
434
|
+
*/
|
|
435
|
+
static requestEmailVerification(email: string, options?: RequestOptions): Promise<void>;
|
|
436
|
+
/**
|
|
437
|
+
* Verify whether a given password is the password of the current user.
|
|
438
|
+
* @static
|
|
439
|
+
*
|
|
440
|
+
* @param {string} username The username of the user whose password should be verified.
|
|
441
|
+
* @param {string} password The password to be verified.
|
|
442
|
+
* @param {object} options The options.
|
|
443
|
+
* @param {boolean} [options.ignoreEmailVerification] Set to `true` to bypass email verification and verify
|
|
444
|
+
* the password regardless of whether the email has been verified. This requires the master key.
|
|
445
|
+
* @returns {Promise} A promise that is fulfilled with a user when the password is correct.
|
|
446
|
+
*/
|
|
447
|
+
static verifyPassword<T extends ParseUser>(username: string, password: string, options?: RequestOptions): Promise<T>;
|
|
448
|
+
/**
|
|
449
|
+
* Allow someone to define a custom User class without className
|
|
450
|
+
* being rewritten to _User. The default behavior is to rewrite
|
|
451
|
+
* User to _User for legacy reasons. This allows developers to
|
|
452
|
+
* override that behavior.
|
|
453
|
+
*
|
|
454
|
+
* @param {boolean} isAllowed Whether or not to allow custom User class
|
|
455
|
+
* @static
|
|
456
|
+
*/
|
|
457
|
+
static allowCustomUserClass(isAllowed: boolean): void;
|
|
458
|
+
/**
|
|
459
|
+
* Allows a legacy application to start using revocable sessions. If the
|
|
460
|
+
* current session token is not revocable, a request will be made for a new,
|
|
461
|
+
* revocable session.
|
|
462
|
+
* It is not necessary to call this method from cloud code unless you are
|
|
463
|
+
* handling user signup or login from the server side. In a cloud code call,
|
|
464
|
+
* this function will not attempt to upgrade the current token.
|
|
465
|
+
*
|
|
466
|
+
* @param {object} options
|
|
467
|
+
* @static
|
|
468
|
+
* @returns {Promise} A promise that is resolved when the process has
|
|
469
|
+
* completed. If a replacement session token is requested, the promise
|
|
470
|
+
* will be resolved after a new token has been fetched.
|
|
471
|
+
*/
|
|
472
|
+
static enableRevocableSession(options?: RequestOptions): Promise<void>;
|
|
473
|
+
/**
|
|
474
|
+
* Enables the use of become or the current user in a server
|
|
475
|
+
* environment. These features are disabled by default, since they depend on
|
|
476
|
+
* global objects that are not memory-safe for most servers.
|
|
477
|
+
*
|
|
478
|
+
* @static
|
|
479
|
+
*/
|
|
480
|
+
static enableUnsafeCurrentUser(): void;
|
|
481
|
+
/**
|
|
482
|
+
* Disables the use of become or the current user in any environment.
|
|
483
|
+
* These features are disabled on servers by default, since they depend on
|
|
484
|
+
* global objects that are not memory-safe for most servers.
|
|
485
|
+
*
|
|
486
|
+
* @static
|
|
487
|
+
*/
|
|
488
|
+
static disableUnsafeCurrentUser(): void;
|
|
489
|
+
/**
|
|
490
|
+
* When registering users with {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith} a basic auth provider
|
|
491
|
+
* is automatically created for you.
|
|
492
|
+
*
|
|
493
|
+
* For advanced authentication, you can register an Auth provider to
|
|
494
|
+
* implement custom authentication, deauthentication.
|
|
495
|
+
*
|
|
496
|
+
* @param provider
|
|
497
|
+
* @see {@link https://parseplatform.org/Parse-SDK-JS/api/master/AuthProvider.html AuthProvider}
|
|
498
|
+
* @see {@link https://docs.parseplatform.org/js/guide/#custom-authentication-module Custom Authentication Module}
|
|
499
|
+
* @static
|
|
500
|
+
*/
|
|
501
|
+
static _registerAuthenticationProvider(provider: any): void;
|
|
502
|
+
/**
|
|
503
|
+
* @param provider
|
|
504
|
+
* @param options
|
|
505
|
+
* @param {object} [options.authData]
|
|
506
|
+
* @param saveOpts
|
|
507
|
+
* @deprecated since 2.9.0 see {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#logInWith logInWith}
|
|
508
|
+
* @static
|
|
509
|
+
* @returns {Promise}
|
|
510
|
+
*/
|
|
511
|
+
static _logInWith(provider: any, options: {
|
|
512
|
+
authData?: AuthData;
|
|
513
|
+
}, saveOpts?: FullOptions): Promise<ParseUser<Attributes>>;
|
|
514
|
+
static _clearCache(): void;
|
|
515
|
+
static _setCurrentUserCache(user: ParseUser): void;
|
|
516
|
+
}
|
|
517
|
+
export default ParseUser;
|
package/types/Push.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import ParseQuery from './ParseQuery';
|
|
2
|
+
import type ParseObject from './ParseObject';
|
|
3
|
+
import type { WhereClause } from './ParseQuery';
|
|
4
|
+
import type { FullOptions } from './RESTController';
|
|
5
|
+
export type PushData = {
|
|
6
|
+
where?: WhereClause | ParseQuery;
|
|
7
|
+
push_time?: Date | string;
|
|
8
|
+
expiration_time?: Date | string;
|
|
9
|
+
expiration_interval?: number;
|
|
10
|
+
data?: any;
|
|
11
|
+
channels?: string[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Contains functions to deal with Push in Parse.
|
|
15
|
+
*
|
|
16
|
+
* @class Parse.Push
|
|
17
|
+
* @static
|
|
18
|
+
* @hideconstructor
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Sends a push notification.
|
|
22
|
+
* **Available in Cloud Code only.**
|
|
23
|
+
*
|
|
24
|
+
* See {@link https://docs.parseplatform.org/js/guide/#push-notifications Push Notification Guide}
|
|
25
|
+
*
|
|
26
|
+
* @function send
|
|
27
|
+
* @name Parse.Push.send
|
|
28
|
+
* @param {object} data - The data of the push notification. Valid fields
|
|
29
|
+
* are:
|
|
30
|
+
* <ol>
|
|
31
|
+
* <li>channels - An Array of channels to push to.</li>
|
|
32
|
+
* <li>push_time - A Date object for when to send the push.</li>
|
|
33
|
+
* <li>expiration_time - A Date object for when to expire
|
|
34
|
+
* the push.</li>
|
|
35
|
+
* <li>expiration_interval - The seconds from now to expire the push.</li>
|
|
36
|
+
* <li>where - A Parse.Query over Parse.Installation that is used to match
|
|
37
|
+
* a set of installations to push to.</li>
|
|
38
|
+
* <li>data - The data to send as part of the push.</li>
|
|
39
|
+
* <ol>
|
|
40
|
+
* @param {object} options Valid options
|
|
41
|
+
* are:<ul>
|
|
42
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
43
|
+
* be used for this request.
|
|
44
|
+
* </ul>
|
|
45
|
+
* @returns {Promise} A promise that is fulfilled when the push request
|
|
46
|
+
* completes and returns `pushStatusId`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function send(data: PushData, options?: FullOptions): Promise<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Gets push status by Id
|
|
51
|
+
*
|
|
52
|
+
* @function getPushStatus
|
|
53
|
+
* @name Parse.Push.getPushStatus
|
|
54
|
+
* @param {string} pushStatusId The Id of Push Status.
|
|
55
|
+
* @param {object} options Valid options
|
|
56
|
+
* are:<ul>
|
|
57
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
58
|
+
* be used for this request.
|
|
59
|
+
* </ul>
|
|
60
|
+
* @returns {Parse.Object} Status of Push.
|
|
61
|
+
*/
|
|
62
|
+
export declare function getPushStatus(pushStatusId: string, options?: FullOptions): Promise<ParseObject>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type RequestOptions = {
|
|
2
|
+
useMasterKey?: boolean;
|
|
3
|
+
useMaintenanceKey?: boolean;
|
|
4
|
+
sessionToken?: string;
|
|
5
|
+
installationId?: string;
|
|
6
|
+
returnStatus?: boolean;
|
|
7
|
+
batchSize?: number;
|
|
8
|
+
include?: any;
|
|
9
|
+
progress?: any;
|
|
10
|
+
context?: any;
|
|
11
|
+
usePost?: boolean;
|
|
12
|
+
ignoreEmailVerification?: boolean;
|
|
13
|
+
transaction?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type FullOptions = {
|
|
16
|
+
success?: any;
|
|
17
|
+
error?: any;
|
|
18
|
+
useMasterKey?: boolean;
|
|
19
|
+
useMaintenanceKey?: boolean;
|
|
20
|
+
sessionToken?: string;
|
|
21
|
+
installationId?: string;
|
|
22
|
+
progress?: any;
|
|
23
|
+
usePost?: boolean;
|
|
24
|
+
};
|
|
25
|
+
declare const RESTController: {
|
|
26
|
+
ajax(method: string, url: string, data: any, headers?: any, options?: FullOptions): (Promise<any> & {
|
|
27
|
+
resolve: (res: any) => void;
|
|
28
|
+
reject: (err: any) => void;
|
|
29
|
+
}) | Promise<unknown>;
|
|
30
|
+
request(method: string, path: string, data: any, options?: RequestOptions): Promise<any>;
|
|
31
|
+
handleError(response: any): Promise<never>;
|
|
32
|
+
_setXHR(xhr: any): void;
|
|
33
|
+
_getXHR(): any;
|
|
34
|
+
};
|
|
35
|
+
export default RESTController;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Op } from './ParseOp';
|
|
2
|
+
import type ParseObject from './ParseObject';
|
|
3
|
+
import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';
|
|
4
|
+
export declare function getState(obj: ParseObject): State | null;
|
|
5
|
+
export declare function initializeState(obj: ParseObject, initial?: State): State;
|
|
6
|
+
export declare function removeState(obj: ParseObject): State | null;
|
|
7
|
+
export declare function getServerData(obj: ParseObject): AttributeMap;
|
|
8
|
+
export declare function setServerData(obj: ParseObject, attributes: AttributeMap): void;
|
|
9
|
+
export declare function getPendingOps(obj: ParseObject): Array<OpsMap>;
|
|
10
|
+
export declare function setPendingOp(obj: ParseObject, attr: string, op?: Op): void;
|
|
11
|
+
export declare function pushPendingState(obj: ParseObject): void;
|
|
12
|
+
export declare function popPendingState(obj: ParseObject): OpsMap;
|
|
13
|
+
export declare function mergeFirstPendingState(obj: ParseObject): void;
|
|
14
|
+
export declare function getObjectCache(obj: ParseObject): ObjectCache;
|
|
15
|
+
export declare function estimateAttribute(obj: ParseObject, attr: string): any;
|
|
16
|
+
export declare function estimateAttributes(obj: ParseObject): AttributeMap;
|
|
17
|
+
export declare function commitServerChanges(obj: ParseObject, changes: AttributeMap): void;
|
|
18
|
+
export declare function enqueueTask(obj: ParseObject, task: () => Promise<any>): Promise<void>;
|
|
19
|
+
export declare function clearAllState(): void;
|
|
20
|
+
export declare function duplicateState(source: {
|
|
21
|
+
id: string;
|
|
22
|
+
}, dest: {
|
|
23
|
+
id: string;
|
|
24
|
+
}): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const Storage: {
|
|
2
|
+
async(): boolean;
|
|
3
|
+
getItem(path: string): string | null;
|
|
4
|
+
getItemAsync(path: string): Promise<string | null>;
|
|
5
|
+
setItem(path: string, value: string): void;
|
|
6
|
+
setItemAsync(path: string, value: string): Promise<void>;
|
|
7
|
+
removeItem(path: string): void;
|
|
8
|
+
removeItemAsync(path: string): Promise<void>;
|
|
9
|
+
getAllKeys(): Array<string>;
|
|
10
|
+
getAllKeysAsync(): Promise<Array<string>>;
|
|
11
|
+
generatePath(path: string): string;
|
|
12
|
+
_clear(): void;
|
|
13
|
+
};
|
|
14
|
+
export default Storage;
|