*
- * @alias Parse.LiveQuerySubscription
*/
class Subscription extends EventEmitter {
- /*
+ /**
+ * @alias Parse.LiveQuerySubscription
* @param {string} id - subscription id
* @param {string} query - query to subscribe to
* @param {string} sessionToken - optional session token
@@ -119,7 +119,7 @@ class Subscription extends EventEmitter {
/**
* Close the subscription
*
- * @returns {Promise}
+ * @returns {Promise}
*/
unsubscribe(): Promise {
return CoreManager.getLiveQueryController()
@@ -129,6 +129,22 @@ class Subscription extends EventEmitter {
this.emit('close');
});
}
+ /**
+ * LiveQuery event Callback
+ *
+ * @callback LiveQueryEventCallback
+ * @param {Parse.Object} object LiveQuery event object
+ * @param {Parse.Object} [original] LiveQuery event original object
+ */
+
+ /**
+ * @param {string} event
+ * @param {LiveQueryEventCallback} callback
+ */
+
+ on(event, callback) {
+ super.on(event, callback);
+ }
}
export default Subscription;
diff --git a/src/Parse.js b/src/Parse.js
index 7554b3c80..8d3891757 100644
--- a/src/Parse.js
+++ b/src/Parse.js
@@ -82,7 +82,7 @@ const Parse = {
/**
* Returns information regarding the current server's health
*
- * @returns {Promise}
+ * @returns {Promise}
* @static
*/
getServerHealth() {
@@ -167,7 +167,7 @@ const Parse = {
},
/**
- * @member {string} Parse.encryptedUser
+ * @member {boolean} Parse.encryptedUser
* @static
*/
set encryptedUser(value) {
@@ -199,6 +199,16 @@ const Parse = {
return CoreManager.get('IDEMPOTENCY');
},
+ /**
+ * @typedef Parse.AuthData
+ * @type {any}
+ */
+
+ /**
+ * @typedef Parse.AuthProvider
+ * @type {any}
+ */
+
/**
* @member {boolean} Parse.allowCustomObjectId
* @static
@@ -227,6 +237,19 @@ Parse.Polygon = require('./ParsePolygon').default;
Parse.Installation = require('./ParseInstallation').default;
Parse.LocalDatastore = require('./LocalDatastore');
Parse.Object = require('./ParseObject').default;
+/**
+ * @static
+ * @typedef Parse.Op
+ * @property {any} Set
+ * @property {any} Unset
+ * @property {any} Increment
+ * @property {any} Add
+ * @property {any} Remove
+ * @property {any} AddUnique
+ * @property {any} Relation
+ *
+ */
+
Parse.Op = {
Set: ParseOp.SetOp,
Unset: ParseOp.UnsetOp,
diff --git a/src/ParseACL.js b/src/ParseACL.js
index 2b6225573..7b20add6e 100644
--- a/src/ParseACL.js
+++ b/src/ParseACL.js
@@ -29,13 +29,13 @@ const PUBLIC_KEY = '*';
* Parse.Object to restrict access to only a subset of users
* of your application.
*
- * @alias Parse.ACL
*/
class ParseACL {
permissionsById: ByIdMap;
/**
- * @param {(Parse.User | object)} arg1 The user to initialize the ACL for
+ * @alias Parse.ACL
+ * @param {(Parse.User | object)} [arg1] The user to initialize the ACL for
*/
constructor(arg1: ParseUser | ByIdMap) {
this.permissionsById = {};
@@ -80,7 +80,7 @@ class ParseACL {
/**
* Returns whether this ACL is equal to another object
*
- * @param {ParseACL} other The other object's ACL to compare to
+ * @param {Parse.ACL} other The other object's ACL to compare to
* @returns {boolean}
*/
equals(other: ParseACL): boolean {
diff --git a/src/ParseCLP.js b/src/ParseCLP.js
index 179132829..92226b050 100644
--- a/src/ParseCLP.js
+++ b/src/ParseCLP.js
@@ -120,12 +120,12 @@ VALID_PERMISSIONS_EXTENDED.set('protectedFields', {});
* setRoleAddFieldAccess(role: Role, allowed: boolean)
*
*
- * @alias Parse.CLP
*/
class ParseCLP {
permissionsMap: PermissionsMap;
/**
+ * @alias Parse.CLP
* @param {(Parse.User | Parse.Role | object)} userId The user to initialize the CLP for
*/
constructor(userId: ParseUser | ParseRole | PermissionsMap) {
diff --git a/src/ParseConfig.js b/src/ParseConfig.js
index de77a8097..fe9a95b70 100644
--- a/src/ParseConfig.js
+++ b/src/ParseConfig.js
@@ -22,13 +22,14 @@ import type { RequestOptions } from './RESTController';
* Parse.Config is a local representation of configuration data that
* can be set from the Parse dashboard.
*
- * @alias Parse.Config
*/
class ParseConfig {
attributes: { [key: string]: any };
_escapedAttributes: { [key: string]: any };
-
+ /**
+ * @alias Parse.Config
+ */
constructor() {
this.attributes = {};
this._escapedAttributes = {};
@@ -86,7 +87,7 @@ class ParseConfig {
*
useMasterKey: In Cloud Code and Node only, causes the Master Key to
* be used for this request.
*
- * @returns {Promise} A promise that is resolved with a newly-created
+ * @returns {Promise} A promise that is resolved with a newly-created
* configuration object when the get completes.
*/
static get(options: RequestOptions = {}) {
@@ -104,7 +105,7 @@ class ParseConfig {
* For example: `param1: true` makes `param1` only retrievable by using the master key.
* If a parameter is not provided or set to `false`, it can be retrieved without
* using the master key.
- * @returns {Promise} A promise that is resolved with a newly-created
+ * @returns {Promise} A promise that is resolved with a newly-created
* configuration object or with the current with the update.
*/
static save(attrs: { [key: string]: any }, masterKeyOnlyFlags: { [key: string]: any }) {
diff --git a/src/ParseError.js b/src/ParseError.js
index e8d11ad84..1a2d4752a 100644
--- a/src/ParseError.js
+++ b/src/ParseError.js
@@ -10,12 +10,13 @@
/**
* Constructs a new Parse.Error object with the given code and message.
*
- * @alias Parse.Error
*/
class ParseError extends Error {
/**
+ * @alias Parse.Error
* @param {number} code An error code constant from Parse.Error.
* @param {string} message A detailed description of the error.
+ *
*/
constructor(code, message) {
super(message);
@@ -34,32 +35,33 @@ class ParseError extends Error {
/**
* Error code indicating some error other than those enumerated here.
*
- * @property {number} OTHER_CAUSE
- * @static
+ * @name ParseError.OTHER_CAUSE
+ * @type {number}
+ *
*/
ParseError.OTHER_CAUSE = -1;
/**
* Error code indicating that something has gone wrong with the server.
*
- * @property {number} INTERNAL_SERVER_ERROR
- * @static
+ * @name ParseError.INTERNAL_SERVER_ERROR
+ * @type {number}
*/
ParseError.INTERNAL_SERVER_ERROR = 1;
/**
* Error code indicating the connection to the Parse servers failed.
*
- * @property {number} CONNECTION_FAILED
- * @static
+ * @name ParseError.CONNECTION_FAILED
+ * @type {number}
*/
ParseError.CONNECTION_FAILED = 100;
/**
* Error code indicating the specified object doesn't exist.
*
- * @property {number} OBJECT_NOT_FOUND
- * @static
+ * @name ParseError.OBJECT_NOT_FOUND
+ * @type {number}
*/
ParseError.OBJECT_NOT_FOUND = 101;
@@ -67,8 +69,8 @@ ParseError.OBJECT_NOT_FOUND = 101;
* Error code indicating you tried to query with a datatype that doesn't
* support it, like exact matching an array or object.
*
- * @property {number} INVALID_QUERY
- * @static
+ * @name ParseError.INVALID_QUERY
+ * @type {number}
*/
ParseError.INVALID_QUERY = 102;
@@ -77,16 +79,16 @@ ParseError.INVALID_QUERY = 102;
* case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
* only valid characters.
*
- * @property {number} INVALID_CLASS_NAME
- * @static
+ * @name ParseError.INVALID_CLASS_NAME
+ * @type {number}
*/
ParseError.INVALID_CLASS_NAME = 103;
/**
* Error code indicating an unspecified object id.
*
- * @property {number} MISSING_OBJECT_ID
- * @static
+ * @name ParseError.MISSING_OBJECT_ID
+ * @type {number}
*/
ParseError.MISSING_OBJECT_ID = 104;
@@ -94,8 +96,8 @@ ParseError.MISSING_OBJECT_ID = 104;
* Error code indicating an invalid key name. Keys are case-sensitive. They
* must start with a letter, and a-zA-Z0-9_ are the only valid characters.
*
- * @property {number} INVALID_KEY_NAME
- * @static
+ * @name ParseError.INVALID_KEY_NAME
+ * @type {number}
*/
ParseError.INVALID_KEY_NAME = 105;
@@ -103,8 +105,8 @@ ParseError.INVALID_KEY_NAME = 105;
* Error code indicating a malformed pointer. You should not see this unless
* you have been mucking about changing internal Parse code.
*
- * @property {number} INVALID_POINTER
- * @static
+ * @name ParseError.INVALID_POINTER
+ * @type {number}
*/
ParseError.INVALID_POINTER = 106;
@@ -113,8 +115,8 @@ ParseError.INVALID_POINTER = 106;
* either indicates you have done something unusual with modifying how
* things encode to JSON, or the network is failing badly.
*
- * @property {number} INVALID_JSON
- * @static
+ * @name ParseError.INVALID_JSON
+ * @type {number}
*/
ParseError.INVALID_JSON = 107;
@@ -122,24 +124,24 @@ ParseError.INVALID_JSON = 107;
* Error code indicating that the feature you tried to access is only
* available internally for testing purposes.
*
- * @property {number} COMMAND_UNAVAILABLE
- * @static
+ * @name ParseError.COMMAND_UNAVAILABLE
+ * @type {number}
*/
ParseError.COMMAND_UNAVAILABLE = 108;
/**
* You must call Parse.initialize before using the Parse library.
*
- * @property {number} NOT_INITIALIZED
- * @static
+ * @name ParseError.NOT_INITIALIZED
+ * @type {number}
*/
ParseError.NOT_INITIALIZED = 109;
/**
* Error code indicating that a field was set to an inconsistent type.
*
- * @property {number} INCORRECT_TYPE
- * @static
+ * @name ParseError.INCORRECT_TYPE
+ * @type {number}
*/
ParseError.INCORRECT_TYPE = 111;
@@ -148,40 +150,40 @@ ParseError.INCORRECT_TYPE = 111;
* an empty string (the broadcast channel) or contains only a-zA-Z0-9_
* characters and starts with a letter.
*
- * @property {number} INVALID_CHANNEL_NAME
- * @static
+ * @name ParseError.INVALID_CHANNEL_NAME
+ * @type {number}
*/
ParseError.INVALID_CHANNEL_NAME = 112;
/**
* Error code indicating that push is misconfigured.
*
- * @property {number} PUSH_MISCONFIGURED
- * @static
+ * @name ParseError.PUSH_MISCONFIGURED
+ * @type {number}
*/
ParseError.PUSH_MISCONFIGURED = 115;
/**
* Error code indicating that the object is too large.
*
- * @property {number} OBJECT_TOO_LARGE
- * @static
+ * @name ParseError.OBJECT_TOO_LARGE
+ * @type {number}
*/
ParseError.OBJECT_TOO_LARGE = 116;
/**
* Error code indicating that the operation isn't allowed for clients.
*
- * @property {number} OPERATION_FORBIDDEN
- * @static
+ * @name ParseError.OPERATION_FORBIDDEN
+ * @type {number}
*/
ParseError.OPERATION_FORBIDDEN = 119;
/**
* Error code indicating the result was not found in the cache.
*
- * @property {number} CACHE_MISS
- * @static
+ * @name ParseError.CACHE_MISS
+ * @type {number}
*/
ParseError.CACHE_MISS = 120;
@@ -189,8 +191,8 @@ ParseError.CACHE_MISS = 120;
* Error code indicating that an invalid key was used in a nested
* JSONObject.
*
- * @property {number} INVALID_NESTED_KEY
- * @static
+ * @name ParseError.INVALID_NESTED_KEY
+ * @type {number}
*/
ParseError.INVALID_NESTED_KEY = 121;
@@ -199,16 +201,16 @@ ParseError.INVALID_NESTED_KEY = 121;
* A valid file name contains only a-zA-Z0-9_. characters and is between 1
* and 128 characters.
*
- * @property {number} INVALID_FILE_NAME
- * @static
+ * @name ParseError.INVALID_FILE_NAME
+ * @type {number}
*/
ParseError.INVALID_FILE_NAME = 122;
/**
* Error code indicating an invalid ACL was provided.
*
- * @property {number} INVALID_ACL
- * @static
+ * @name ParseError.INVALID_ACL
+ * @type {number}
*/
ParseError.INVALID_ACL = 123;
@@ -216,56 +218,56 @@ ParseError.INVALID_ACL = 123;
* Error code indicating that the request timed out on the server. Typically
* this indicates that the request is too expensive to run.
*
- * @property {number} TIMEOUT
- * @static
+ * @name ParseError.TIMEOUT
+ * @type {number}
*/
ParseError.TIMEOUT = 124;
/**
* Error code indicating that the email address was invalid.
*
- * @property {number} INVALID_EMAIL_ADDRESS
- * @static
+ * @name ParseError.INVALID_EMAIL_ADDRESS
+ * @type {number}
*/
ParseError.INVALID_EMAIL_ADDRESS = 125;
/**
* Error code indicating a missing content type.
*
- * @property {number} MISSING_CONTENT_TYPE
- * @static
+ * @name ParseError.MISSING_CONTENT_TYPE
+ * @type {number}
*/
ParseError.MISSING_CONTENT_TYPE = 126;
/**
* Error code indicating a missing content length.
*
- * @property {number} MISSING_CONTENT_LENGTH
- * @static
+ * @name ParseError.MISSING_CONTENT_LENGTH
+ * @type {number}
*/
ParseError.MISSING_CONTENT_LENGTH = 127;
/**
* Error code indicating an invalid content length.
*
- * @property {number} INVALID_CONTENT_LENGTH
- * @static
+ * @name ParseError.INVALID_CONTENT_LENGTH
+ * @type {number}
*/
ParseError.INVALID_CONTENT_LENGTH = 128;
/**
* Error code indicating a file that was too large.
*
- * @property {number} FILE_TOO_LARGE
- * @static
+ * @name ParseError.FILE_TOO_LARGE
+ * @type {number}
*/
ParseError.FILE_TOO_LARGE = 129;
/**
* Error code indicating an error saving a file.
*
- * @property {number} FILE_SAVE_ERROR
- * @static
+ * @name ParseError.FILE_SAVE_ERROR
+ * @type {number}
*/
ParseError.FILE_SAVE_ERROR = 130;
@@ -273,16 +275,16 @@ ParseError.FILE_SAVE_ERROR = 130;
* Error code indicating that a unique field was given a value that is
* already taken.
*
- * @property {number} DUPLICATE_VALUE
- * @static
+ * @name ParseError.DUPLICATE_VALUE
+ * @type {number}
*/
ParseError.DUPLICATE_VALUE = 137;
/**
* Error code indicating that a role's name is invalid.
*
- * @property {number} INVALID_ROLE_NAME
- * @static
+ * @name ParseError.INVALID_ROLE_NAME
+ * @type {number}
*/
ParseError.INVALID_ROLE_NAME = 139;
@@ -290,64 +292,64 @@ ParseError.INVALID_ROLE_NAME = 139;
* Error code indicating that an application quota was exceeded. Upgrade to
* resolve.
*
- * @property {number} EXCEEDED_QUOTA
- * @static
+ * @name ParseError.EXCEEDED_QUOTA
+ * @type {number}
*/
ParseError.EXCEEDED_QUOTA = 140;
/**
* Error code indicating that a Cloud Code script failed.
*
- * @property {number} SCRIPT_FAILED
- * @static
+ * @name ParseError.SCRIPT_FAILED
+ * @type {number}
*/
ParseError.SCRIPT_FAILED = 141;
/**
* Error code indicating that a Cloud Code validation failed.
*
- * @property {number} VALIDATION_ERROR
- * @static
+ * @name ParseError.VALIDATION_ERROR
+ * @type {number}
*/
ParseError.VALIDATION_ERROR = 142;
/**
* Error code indicating that invalid image data was provided.
*
- * @property {number} INVALID_IMAGE_DATA
- * @static
+ * @name ParseError.INVALID_IMAGE_DATA
+ * @type {number}
*/
ParseError.INVALID_IMAGE_DATA = 143;
/**
* Error code indicating an unsaved file.
*
- * @property {number} UNSAVED_FILE_ERROR
- * @static
+ * @name ParseError.UNSAVED_FILE_ERROR
+ * @type {number}
*/
ParseError.UNSAVED_FILE_ERROR = 151;
/**
* Error code indicating an invalid push time.
*
- * @property {number} INVALID_PUSH_TIME_ERROR
- * @static
+ * @name ParseError.INVALID_PUSH_TIME_ERROR
+ * @type {number}
*/
ParseError.INVALID_PUSH_TIME_ERROR = 152;
/**
* Error code indicating an error deleting a file.
*
- * @property {number} FILE_DELETE_ERROR
- * @static
+ * @name ParseError.FILE_DELETE_ERROR
+ * @type {number}
*/
ParseError.FILE_DELETE_ERROR = 153;
/**
* Error code indicating an error deleting an unnamed file.
*
- * @property {number} FILE_DELETE_UNNAMED_ERROR
- * @static
+ * @name ParseError.FILE_DELETE_UNNAMED_ERROR
+ * @type {number}
*/
ParseError.FILE_DELETE_UNNAMED_ERROR = 161;
@@ -355,8 +357,8 @@ ParseError.FILE_DELETE_UNNAMED_ERROR = 161;
* Error code indicating that the application has exceeded its request
* limit.
*
- * @property {number} REQUEST_LIMIT_EXCEEDED
- * @static
+ * @name ParseError.REQUEST_LIMIT_EXCEEDED
+ * @type {number}
*/
ParseError.REQUEST_LIMIT_EXCEEDED = 155;
@@ -364,72 +366,72 @@ ParseError.REQUEST_LIMIT_EXCEEDED = 155;
* Error code indicating that the request was a duplicate and has been discarded due to
* idempotency rules.
*
- * @property {number} DUPLICATE_REQUEST
- * @static
+ * @name ParseError.DUPLICATE_REQUEST
+ * @type {number}
*/
ParseError.DUPLICATE_REQUEST = 159;
/**
* Error code indicating an invalid event name.
*
- * @property {number} INVALID_EVENT_NAME
- * @static
+ * @name ParseError.INVALID_EVENT_NAME
+ * @type {number}
*/
ParseError.INVALID_EVENT_NAME = 160;
/**
* Error code indicating that a field had an invalid value.
*
- * @property {number} INVALID_VALUE
- * @static
+ * @name ParseError.INVALID_VALUE
+ * @type {number}
*/
ParseError.INVALID_VALUE = 162;
/**
* Error code indicating that the username is missing or empty.
*
- * @property {number} USERNAME_MISSING
- * @static
+ * @name ParseError.USERNAME_MISSING
+ * @type {number}
*/
ParseError.USERNAME_MISSING = 200;
/**
* Error code indicating that the password is missing or empty.
*
- * @property {number} PASSWORD_MISSING
- * @static
+ * @name ParseError.PASSWORD_MISSING
+ * @type {number}
*/
ParseError.PASSWORD_MISSING = 201;
/**
* Error code indicating that the username has already been taken.
*
- * @property {number} USERNAME_TAKEN
- * @static
+ * @name ParseError.USERNAME_TAKEN
+ * @type {number}
*/
ParseError.USERNAME_TAKEN = 202;
/**
* Error code indicating that the email has already been taken.
*
- * @property {number} EMAIL_TAKEN
- * @static
+ * @name ParseError.EMAIL_TAKEN
+ * @type {number}
*/
ParseError.EMAIL_TAKEN = 203;
/**
* Error code indicating that the email is missing, but must be specified.
*
- * @property {number} EMAIL_MISSING
- * @static
+ * @name ParseError.EMAIL_MISSING
+ * @type {number}
*/
ParseError.EMAIL_MISSING = 204;
/**
* Error code indicating that a user with the specified email was not found.
*
- * @property {number} EMAIL_NOT_FOUND
- * @static
+ * @name ParseError.EMAIL_NOT_FOUND
+ * @type {number}
*/
ParseError.EMAIL_NOT_FOUND = 205;
@@ -437,16 +439,16 @@ ParseError.EMAIL_NOT_FOUND = 205;
* Error code indicating that a user object without a valid session could
* not be altered.
*
- * @property {number} SESSION_MISSING
- * @static
+ * @name ParseError.SESSION_MISSING
+ * @type {number}
*/
ParseError.SESSION_MISSING = 206;
/**
* Error code indicating that a user can only be created through signup.
*
- * @property {number} MUST_CREATE_USER_THROUGH_SIGNUP
- * @static
+ * @name ParseError.MUST_CREATE_USER_THROUGH_SIGNUP
+ * @type {number}
*/
ParseError.MUST_CREATE_USER_THROUGH_SIGNUP = 207;
@@ -454,32 +456,32 @@ ParseError.MUST_CREATE_USER_THROUGH_SIGNUP = 207;
* Error code indicating that an an account being linked is already linked
* to another user.
*
- * @property {number} ACCOUNT_ALREADY_LINKED
- * @static
+ * @name ParseError.ACCOUNT_ALREADY_LINKED
+ * @type {number}
*/
ParseError.ACCOUNT_ALREADY_LINKED = 208;
/**
* Error code indicating that the current session token is invalid.
*
- * @property {number} INVALID_SESSION_TOKEN
- * @static
+ * @name ParseError.INVALID_SESSION_TOKEN
+ * @type {number}
*/
ParseError.INVALID_SESSION_TOKEN = 209;
/**
* Error code indicating an error enabling or verifying MFA
*
- * @property {number} MFA_ERROR
- * @static
+ * @name ParseError.MFA_ERROR
+ * @type {number}
*/
ParseError.MFA_ERROR = 210;
/**
* Error code indicating that a valid MFA token must be provided
*
- * @property {number} MFA_TOKEN_REQUIRED
- * @static
+ * @name ParseError.MFA_TOKEN_REQUIRED
+ * @type {number}
*/
ParseError.MFA_TOKEN_REQUIRED = 211;
@@ -487,8 +489,8 @@ ParseError.MFA_TOKEN_REQUIRED = 211;
* Error code indicating that a user cannot be linked to an account because
* that account's id could not be found.
*
- * @property {number} LINKED_ID_MISSING
- * @static
+ * @name ParseError.LINKED_ID_MISSING
+ * @type {number}
*/
ParseError.LINKED_ID_MISSING = 250;
@@ -496,8 +498,8 @@ ParseError.LINKED_ID_MISSING = 250;
* Error code indicating that a user with a linked (e.g. Facebook) account
* has an invalid session.
*
- * @property {number} INVALID_LINKED_SESSION
- * @static
+ * @name ParseError.INVALID_LINKED_SESSION
+ * @type {number}
*/
ParseError.INVALID_LINKED_SESSION = 251;
@@ -505,16 +507,16 @@ ParseError.INVALID_LINKED_SESSION = 251;
* Error code indicating that a service being linked (e.g. Facebook or
* Twitter) is unsupported.
*
- * @property {number} UNSUPPORTED_SERVICE
- * @static
+ * @name ParseError.UNSUPPORTED_SERVICE
+ * @type {number}
*/
ParseError.UNSUPPORTED_SERVICE = 252;
/**
* Error code indicating an invalid operation occured on schema
*
- * @property {number} INVALID_SCHEMA_OPERATION
- * @static
+ * @name ParseError.INVALID_SCHEMA_OPERATION
+ * @type {number}
*/
ParseError.INVALID_SCHEMA_OPERATION = 255;
@@ -523,16 +525,16 @@ ParseError.INVALID_SCHEMA_OPERATION = 255;
* have an "errors" property, which is an array of error objects with more
* detail about each error that occurred.
*
- * @property {number} AGGREGATE_ERROR
- * @static
+ * @name ParseError.AGGREGATE_ERROR
+ * @type {number}
*/
ParseError.AGGREGATE_ERROR = 600;
/**
* Error code indicating the client was unable to read an input file.
*
- * @property {number} FILE_READ_ERROR
- * @static
+ * @name ParseError.FILE_READ_ERROR
+ * @type {number}
*/
ParseError.FILE_READ_ERROR = 601;
@@ -542,8 +544,8 @@ ParseError.FILE_READ_ERROR = 601;
* Internet Explorer, which strips the body from HTTP responses that have
* a non-2XX status code.
*
- * @property {number} X_DOMAIN_REQUEST
- * @static
+ * @name ParseError.X_DOMAIN_REQUEST
+ * @type {number}
*/
ParseError.X_DOMAIN_REQUEST = 602;
diff --git a/src/ParseFile.js b/src/ParseFile.js
index 9470b4813..01e0cbe0e 100644
--- a/src/ParseFile.js
+++ b/src/ParseFile.js
@@ -67,7 +67,6 @@ function b64Digit(number: number): string {
* A Parse.File is a local representation of a file that is saved to the Parse
* cloud.
*
- * @alias Parse.File
*/
class ParseFile {
_name: string;
@@ -80,11 +79,11 @@ class ParseFile {
_tags: ?Object;
/**
- * @param name {String} The file's name. This will be prefixed by a unique
+ * @param name {string} The file's name. This will be prefixed by a unique
* value once the file has finished saving. The file name must begin with
* an alphanumeric character, and consist of alphanumeric characters,
* periods, spaces, underscores, or dashes.
- * @param data {Array} The data for the file, as either:
+ * @param {Array | Blob | object} data The data for the file, as either:
* 1. an Array of byte value Numbers, or
* 2. an Object like { base64: "..." } with a base64-encoded String.
* 3. an Object like { uri: "..." } with a uri String.
@@ -103,11 +102,12 @@ class ParseFile {
* // The file either could not be read, or could not be saved to Parse.
* });
* }
- * @param type {String} Optional Content-Type header to use for the file. If
+ * @param {string} [type] Optional Content-Type header to use for the file. If
* this is omitted, the content type will be inferred from the name's
* extension.
- * @param metadata {Object} Optional key value pairs to be stored with file object
- * @param tags {Object} Optional key value pairs to be stored with file object
+ * @param {object} [metadata] Optional key value pairs to be stored with file object
+ * @param {object} [tags] Optional key value pairs to be stored with file object
+ * @alias Parse.File
*/
constructor(name: string, data?: FileData, type?: string, metadata?: Object, tags?: Object) {
const specifiedType = type || '';
@@ -168,7 +168,7 @@ class ParseFile {
* Data is present if initialized with Byte Array, Base64 or Saved with Uri.
* Data is cleared if saved with File object selected with a file upload control
*
- * @returns {Promise} Promise that is resolve with base64 data
+ * @returns {Promise} Promise that is resolve with base64 data
*/
async getData(): Promise {
if (this._data) {
@@ -201,7 +201,8 @@ class ParseFile {
* Gets the url of the file. It is only available after you save the file or
* after you get the file from a Parse.Object.
*
- * @param {object} options An object to specify url options
+ * @param {object} [options] An object to specify url options
+ * @param {boolean} [options.forceSecure] Force secure
* @returns {string}
*/
url(options?: { forceSecure?: boolean }): ?string {
@@ -237,7 +238,7 @@ class ParseFile {
/**
* Saves the file to the Parse cloud.
*
- * @param {object} options
+ * @param {FullOptions} [options]
* * Valid options are:
*
useMasterKey: In Cloud Code and Node only, causes the Master Key to
* be used for this request.
@@ -255,7 +256,7 @@ class ParseFile {
* });
*
*
- * @returns {Promise} Promise that is resolved when the save finishes.
+ * @returns {Promise} Promise that is resolved when the save finishes.
*/
save(options?: FullOptions) {
options = options || {};
@@ -323,12 +324,12 @@ class ParseFile {
* Deletes the file from the Parse cloud.
* In Cloud Code and Node only with Master Key.
*
- * @param {object} options
+ * @param {FullOptions} [options]
* * Valid options are:
*
useMasterKey: In Cloud Code and Node only, causes the Master Key to
* be used for this request.
*
- * @returns {Promise} Promise that is resolved when the delete finishes.
+ * @returns {Promise} Promise that is resolved when the delete finishes.
*/
destroy(options?: FullOptions = {}) {
if (!this._name) {
@@ -346,6 +347,12 @@ class ParseFile {
});
}
+ /**
+ * Returns a JSON representation of this file.
+ *
+ * @returns {object} The JSON representation of the file.
+ */
+
toJSON(): { name: ?string, url: ?string } {
return {
__type: 'File',
diff --git a/src/ParseGeoPoint.js b/src/ParseGeoPoint.js
index 001dca8a1..e31a79c62 100644
--- a/src/ParseGeoPoint.js
+++ b/src/ParseGeoPoint.js
@@ -32,14 +32,14 @@
*
* @alias Parse.GeoPoint
*/
-/* global navigator */
class ParseGeoPoint {
_latitude: number;
_longitude: number;
/**
- * @param {(number[] | object | number)} arg1 Either a list of coordinate pairs, an object with `latitude`, `longitude`, or the latitude or the point.
- * @param {number} arg2 The longitude of the GeoPoint
+ * @alias Parse.GeoPoint
+ * @param {(number[] | object | number)} [arg1] Either a list of coordinate pairs, an object with `latitude`, `longitude`, or the latitude or the point.
+ * @param {number} [arg2] The longitude of the GeoPoint
*/
constructor(
arg1: Array | { latitude: number, longitude: number } | number,
@@ -194,6 +194,7 @@ class ParseGeoPoint {
* @returns {Parse.GeoPoint} User's current location
*/
static current() {
+ /* global navigator */
return navigator.geolocation.getCurrentPosition(location => {
return new ParseGeoPoint(location.coords.latitude, location.coords.longitude);
});
diff --git a/src/ParseInstallation.js b/src/ParseInstallation.js
index 882214706..d3836926f 100644
--- a/src/ParseInstallation.js
+++ b/src/ParseInstallation.js
@@ -14,6 +14,10 @@ import ParseObject from './ParseObject';
import type { AttributeMap } from './ObjectStateMutations';
export default class Installation extends ParseObject {
+ /**
+ * @alias Parse.Installation
+ * @param {object} [attributes] The initial set of data to store in the installation.
+ */
constructor(attributes: ?AttributeMap) {
super('_Installation');
if (attributes && typeof attributes === 'object') {
diff --git a/src/ParseLiveQuery.js b/src/ParseLiveQuery.js
index d50dcff06..7e083f10b 100644
--- a/src/ParseLiveQuery.js
+++ b/src/ParseLiveQuery.js
@@ -49,6 +49,11 @@ const LiveQuery = new EventEmitter();
/**
* After open is called, the LiveQuery will try to send a connect request
* to the LiveQuery server.
+ *
+ * @function open
+ * @name Parse.LiveQuery.open
+ * @param {Function} func function to run on open
+ * @static
*/
LiveQuery.open = async () => {
const liveQueryClient = await getLiveQueryClient();
@@ -61,6 +66,11 @@ LiveQuery.open = async () => {
* cancel the auto reconnect, and unsubscribe all subscriptions based on it.
* If you call query.subscribe() after this, we'll create a new WebSocket
* connection to the LiveQuery server.
+ *
+ * @function close
+ * @name Parse.LiveQuery.close
+ * @param {Function} func function to run on close
+ * @static
*/
LiveQuery.close = async () => {
const liveQueryClient = await getLiveQueryClient();
diff --git a/src/ParseObject.js b/src/ParseObject.js
index 87738d56f..2a0692ed0 100644
--- a/src/ParseObject.js
+++ b/src/ParseObject.js
@@ -45,6 +45,27 @@ import type { RequestOptions, FullOptions } from './RESTController';
const uuidv4 = require('./uuid');
+/**
+ * @typedef Parse.Pointer
+ * @property {string} __type
+ * @property {string} className
+ * @property {string} objectId
+ */
+
+/**
+ * Typedef for SaveParams
+ *
+ * @typedef SaveParams
+ * @property {boolean} [cascadeSave] cascadeSave
+ * @property {Attributes} [content] context
+ */
+
+/**
+ *
+ * @typedef {FullOptions | SaveParams} SaveOptions
+ *
+ */
+
export type Pointer = {
__type: string,
className: string,
@@ -87,6 +108,11 @@ function getServerUrlPath() {
return url.substr(url.indexOf('/'));
}
+/**
+ * @typedef Attributes
+ * @type {object.}
+ */
+
/**
* Creates a new model with defined attributes.
*
@@ -105,12 +131,16 @@ function getServerUrlPath() {
*
* @alias Parse.Object
*/
+
class ParseObject {
/**
- * @param {string} className The class name for the object
- * @param {object} attributes The initial set of data to store in the object.
- * @param {object} options The options for this object instance.
+ * @alias Parse.Object
+ * @param {string} [className] The class name for the object
+ * @param {object} [attributes] The initial set of data to store in the object.
+ * @param {object} [options] The options for this object instance.
+ * @param {boolean} [options.ignoreValidation] Ignore validation
*/
+
constructor(
className: ?string | { className: string, [attr: string]: mixed },
attributes?: { [attr: string]: mixed },
@@ -157,6 +187,12 @@ class ParseObject {
/** Prototype getters / setters **/
+ /**
+ * Object attributes
+ *
+ * @type {object}
+ */
+
get attributes(): AttributeMap {
const stateController = CoreManager.getObjectStateController();
return Object.freeze(stateController.estimateAttributes(this._getStateIdentifier()));
@@ -165,9 +201,9 @@ class ParseObject {
/**
* The first time this object was saved on the server.
*
- * @property {Date} createdAt
- * @returns {Date}
+ * @type {Date}
*/
+
get createdAt(): ?Date {
return this._getServerData().createdAt;
}
@@ -175,8 +211,7 @@ class ParseObject {
/**
* The last time this object was updated on the server.
*
- * @property {Date} updatedAt
- * @returns {Date}
+ * @type {Date}
*/
get updatedAt(): ?Date {
return this._getServerData().updatedAt;
@@ -462,8 +497,8 @@ class ParseObject {
/**
* Returns a JSON version of the object suitable for saving to Parse.
*
- * @param seen
- * @param offline
+ * @param [seen]
+ * @param [offline]
* @returns {object}
*/
toJSON(seen: Array | void, offline?: boolean): AttributeMap {
@@ -512,7 +547,7 @@ class ParseObject {
* save/refresh. If an attribute is specified, it returns true only if that
* particular attribute has been modified since the last save/refresh.
*
- * @param {string} attr An attribute name (optional).
+ * @param {string} [attr] An attribute name (optional).
* @returns {boolean}
*/
dirty(attr?: string): boolean {
@@ -691,10 +726,10 @@ class ParseObject {
* game.set("player.score", 10);
*
* @param {(string|object)} key The key to set.
- * @param {(string|object)} value The value to give it.
- * @param {object} options A set of options for the set.
+ * @param {(string|object)} [value] The value to give it. Optional if `key` is an object.
+ * @param {object} [options] A set of options for the set.
* The only supported option is error.
- * @returns {(ParseObject|boolean)} true if the set succeeded.
+ * @returns {(Parse.Object|boolean)} true if the set succeeded.
*/
set(key: mixed, value: mixed, options?: mixed): ParseObject | boolean {
let changes = {};
@@ -791,8 +826,8 @@ class ParseObject {
* exist.
*
* @param {string} attr The string name of an attribute.
- * @param options
- * @returns {(ParseObject | boolean)}
+ * @param {object} [options]
+ * @returns {(Parse.Object | boolean)}
*/
unset(attr: string, options?: { [opt: string]: mixed }): ParseObject | boolean {
options = options || {};
@@ -804,9 +839,9 @@ class ParseObject {
* Atomically increments the value of the given attribute the next time the
* object is saved. If no amount is specified, 1 is used by default.
*
- * @param attr {String} The key.
- * @param amount {Number} The amount to increment by (optional).
- * @returns {(ParseObject|boolean)}
+ * @param {string} attr The key.
+ * @param {number} [amount] The amount to increment by (optional).
+ * @returns {(Parse.Object|boolean)}
*/
increment(attr: string, amount?: number): ParseObject | boolean {
if (typeof amount === 'undefined') {
@@ -823,8 +858,8 @@ class ParseObject {
* object is saved. If no amount is specified, 1 is used by default.
*
* @param attr {String} The key.
- * @param amount {Number} The amount to decrement by (optional).
- * @returns {(ParseObject | boolean)}
+ * @param [amount] {Number} The amount to decrement by (optional).
+ * @returns {(Parse.Object | boolean)}
*/
decrement(attr: string, amount?: number): ParseObject | boolean {
if (typeof amount === 'undefined') {
@@ -842,7 +877,7 @@ class ParseObject {
*
* @param attr {String} The key.
* @param item {} The item to add.
- * @returns {(ParseObject | boolean)}
+ * @returns {(Parse.Object | boolean)}
*/
add(attr: string, item: mixed): ParseObject | boolean {
return this.set(attr, new AddOp([item]));
@@ -853,8 +888,8 @@ class ParseObject {
* key.
*
* @param attr {String} The key.
- * @param items {Object[]} The items to add.
- * @returns {(ParseObject | boolean)}
+ * @param items {Array} The items to add.
+ * @returns {(Parse.Object | boolean)}
*/
addAll(attr: string, items: Array): ParseObject | boolean {
return this.set(attr, new AddOp(items));
@@ -867,7 +902,7 @@ class ParseObject {
*
* @param attr {String} The key.
* @param item {} The object to add.
- * @returns {(ParseObject | boolean)}
+ * @returns {(Parse.Object | boolean)}
*/
addUnique(attr: string, item: mixed): ParseObject | boolean {
return this.set(attr, new AddUniqueOp([item]));
@@ -879,8 +914,8 @@ class ParseObject {
* not guaranteed.
*
* @param attr {String} The key.
- * @param items {Object[]} The objects to add.
- * @returns {(ParseObject | boolean)}
+ * @param items {Array} The objects to add.
+ * @returns {(Parse.Object | boolean)}
*/
addAllUnique(attr: string, items: Array): ParseObject | boolean {
return this.set(attr, new AddUniqueOp(items));
@@ -892,7 +927,7 @@ class ParseObject {
*
* @param attr {String} The key.
* @param item {} The object to remove.
- * @returns {(ParseObject | boolean)}
+ * @returns {(Parse.Object | boolean)}
*/
remove(attr: string, item: mixed): ParseObject | boolean {
return this.set(attr, new RemoveOp([item]));
@@ -903,8 +938,8 @@ class ParseObject {
* with a given key.
*
* @param attr {String} The key.
- * @param items {Object[]} The object to remove.
- * @returns {(ParseObject | boolean)}
+ * @param items {Array} The object to remove.
+ * @returns {(Parse.Object | boolean)}
*/
removeAll(attr: string, items: Array): ParseObject | boolean {
return this.set(attr, new RemoveOp(items));
@@ -1079,8 +1114,8 @@ class ParseObject {
* Sets the ACL to be used for this object.
*
* @param {Parse.ACL} acl An instance of Parse.ACL.
- * @param {object} options
- * @returns {(ParseObject | boolean)} Whether the set passed validation.
+ * @param {object} [options]
+ * @returns {(Parse.Object | boolean)} Whether the set passed validation.
* @see Parse.Object#set
*/
setACL(acl: ParseACL, options?: mixed): ParseObject | boolean {
@@ -1090,7 +1125,7 @@ class ParseObject {
/**
* Clears any (or specific) changes to this object made since the last call to save()
*
- * @param {string} [keys] - specify which fields to revert
+ * @param {string} keys - specify which fields to revert
*/
revert(...keys: Array): void {
let keysToRevert;
@@ -1110,7 +1145,7 @@ class ParseObject {
/**
* Clears all attributes on a model
*
- * @returns {(ParseObject | boolean)}
+ * @returns {(Parse.Object | boolean)}
*/
clear(): ParseObject | boolean {
const attributes = this.attributes;
@@ -1131,7 +1166,7 @@ class ParseObject {
* Fetch the model from the server. If the server's representation of the
* model differs from its current attributes, they will be overriden.
*
- * @param {object} options
+ * @param {RequestOptions} [options]
* Valid options are:
*
useMasterKey: In Cloud Code and Node only, causes the Master Key to
* be used for this request.
@@ -1141,7 +1176,7 @@ class ParseObject {
* or an array of array of strings.
*
context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
*
- * @returns {Promise} A promise that is fulfilled when the fetch
+ * @returns {Promise} A promise that is fulfilled when the fetch
* completes.
*/
fetch(options: RequestOptions): Promise {
@@ -1182,14 +1217,14 @@ class ParseObject {
* notation to specify which fields in the included object are also fetched.
*
* @param {string | Array>} keys The name(s) of the key(s) to include.
- * @param {object} options
+ * @param {RequestOptions} [options]
* Valid options are:
*
useMasterKey: In Cloud Code and Node only, causes the Master Key to
* be used for this request.
*
sessionToken: A valid session token, used for making a request on
* behalf of a specific user.
*
- * @returns {Promise} A promise that is fulfilled when the fetch
+ * @returns {Promise} A promise that is fulfilled when the fetch
* completes.
*/
fetchWithInclude(keys: String | Array>, options: RequestOptions): Promise {
@@ -1210,7 +1245,7 @@ class ParseObject {
* available. Objects saved this way will persist even after the app is closed, in which case they will be sent the
* next time the app is opened.
*
- * @param {object} [options]
+ * @param {SaveOptions} [options]
* Used to pass option parameters to method if arg1 and arg2 were both passed as strings.
* Valid options are:
*
@@ -1219,7 +1254,7 @@ class ParseObject {
*
cascadeSave: If `false`, nested objects will not be saved (default is `true`).
*
context: A dictionary that is accessible in Cloud Code `beforeSave` and `afterSave` triggers.
*
- * @returns {Promise} A promise that is fulfilled when the save
+ * @returns {Promise} A promise that is fulfilled when the save
* completes.
*/
async saveEventually(options: SaveOptions): Promise {
@@ -1269,7 +1304,7 @@ class ParseObject {
*
`String` Key - Key of attribute to update (requires arg2 to also be string)
*
`null` - Passing null for arg1 allows you to save the object with options passed in arg2.
*
- * @param {object} [arg3]
+ * @param {SaveOptions} [arg3]
* Used to pass option parameters to method if arg1 and arg2 were both passed as strings.
* Valid options are:
*
@@ -1294,7 +1329,7 @@ class ParseObject {
*
cascadeSave: If `false`, nested objects will not be saved (default is `true`).
*
context: A dictionary that is accessible in Cloud Code `beforeSave` and `afterSave` triggers.
*
- * @returns {Promise} A promise that is fulfilled when the save
+ * @returns {Promise} A promise that is fulfilled when the save
* completes.
*/
save(
@@ -1357,13 +1392,13 @@ class ParseObject {
* is available. Delete requests will persist even after the app is closed, in which case they will be sent the
* next time the app is opened.
*
- * @param {object} [options]
+ * @param {RequestOptions} [options]
* Valid options are:
*
sessionToken: A valid session token, used for making a request on
* behalf of a specific user.
*
context: A dictionary that is accessible in Cloud Code `beforeDelete` and `afterDelete` triggers.
*
- * @returns {Promise} A promise that is fulfilled when the destroy
+ * @returns {Promise} A promise that is fulfilled when the destroy
* completes.
*/
async destroyEventually(options: RequestOptions): Promise {
@@ -1389,7 +1424,7 @@ class ParseObject {
* behalf of a specific user.
*
context: A dictionary that is accessible in Cloud Code `beforeDelete` and `afterDelete` triggers.
*
- * @returns {Promise} A promise that is fulfilled when the destroy
+ * @returns {Promise} A promise that is fulfilled when the destroy
* completes.
*/
destroy(options: RequestOptions): Promise {
@@ -1424,7 +1459,7 @@ class ParseObject {
* To retrieve object:
* query.fromLocalDatastore() or query.fromPin()
*
- * @returns {Promise} A promise that is fulfilled when the pin completes.
+ * @returns {Promise} A promise that is fulfilled when the pin completes.
*/
pin(): Promise {
return ParseObject.pinAllWithName(DEFAULT_PIN, [this]);
@@ -1438,7 +1473,7 @@ class ParseObject {
* await object.unPin();
*
*
- * @returns {Promise} A promise that is fulfilled when the unPin completes.
+ * @returns {Promise} A promise that is fulfilled when the unPin completes.
*/
unPin(): Promise {
return ParseObject.unPinAllWithName(DEFAULT_PIN, [this]);
@@ -1477,7 +1512,7 @@ class ParseObject {
* query.fromLocalDatastore() or query.fromPinWithName(name)
*
* @param {string} name Name of Pin.
- * @returns {Promise} A promise that is fulfilled when the pin completes.
+ * @returns {Promise} A promise that is fulfilled when the pin completes.
*/
pinWithName(name: string): Promise {
return ParseObject.pinAllWithName(name, [this]);
@@ -1491,7 +1526,7 @@ class ParseObject {
*
*
* @param {string} name Name of Pin.
- * @returns {Promise} A promise that is fulfilled when the unPin completes.
+ * @returns {Promise} A promise that is fulfilled when the unPin completes.
*/
unPinWithName(name: string): Promise {
return ParseObject.unPinAllWithName(name, [this]);
@@ -1507,7 +1542,7 @@ class ParseObject {
* You can create an unfetched pointer with Parse.Object.createWithoutData()
* and then call fetchFromLocalDatastore() on it.
*
- * @returns {Promise} A promise that is fulfilled when the fetch completes.
+ * @returns {Promise} A promise that is fulfilled when the fetch completes.
*/
async fetchFromLocalDatastore(): Promise {
const localDatastore = CoreManager.getLocalDatastore();
@@ -1581,23 +1616,17 @@ class ParseObject {
* If any error is encountered, stops and calls the error handler.
*
*
- * Parse.Object.fetchAllWithInclude([object1, object2, ...], [pointer1, pointer2, ...])
- * .then((list) => {
- * // All the objects were fetched.
- * }, (error) => {
- * // An error occurred while fetching one of the objects.
- * });
+ * Parse.Object.fetchAllWithInclude([object1, object2, ...], [pointer1, pointer2, ...])
+ * .then((list) => {
+ * // All the objects were fetched.
+ * }, (error) => {
+ * // An error occurred while fetching one of the objects.
+ * });
*
*
* @param {Array} list A list of Parse.Object.
* @param {string | Array>} keys The name(s) of the key(s) to include.
- * @param {object} options
- * Valid options are:
- *
useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- *
sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- *
+ * @param {RequestOptions} [options]
* @static
* @returns {Parse.Object[]}
*/
@@ -1621,23 +1650,17 @@ class ParseObject {
* If any error is encountered, stops and calls the error handler.
*
*
- * Parse.Object.fetchAllIfNeededWithInclude([object1, object2, ...], [pointer1, pointer2, ...])
- * .then((list) => {
- * // All the objects were fetched.
- * }, (error) => {
- * // An error occurred while fetching one of the objects.
- * });
+ * Parse.Object.fetchAllIfNeededWithInclude([object1, object2, ...], [pointer1, pointer2, ...])
+ * .then((list) => {
+ * // All the objects were fetched.
+ * }, (error) => {
+ * // An error occurred while fetching one of the objects.
+ * });
*
*
* @param {Array} list A list of Parse.Object.
* @param {string | Array>} keys The name(s) of the key(s) to include.
- * @param {object} options
- * Valid options are:
- *
useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- *
sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- *
+ * @param {RequestOptions} [options]
* @static
* @returns {Parse.Object[]}
*/
@@ -1744,7 +1767,7 @@ class ParseObject {
* @param {Array} list A list of Parse.Object.
* @param {object} options
* @static
- * @returns {Promise} A promise that is fulfilled when the destroyAll
+ * @returns {Promise} A promise that is fulfilled when the destroyAll
* completes.
*/
static destroyAll(list: Array, options = {}) {
@@ -1778,10 +1801,11 @@ class ParseObject {
*
*
* @param {Array} list A list of Parse.Object.
- * @param {object} options
+ * @param {RequestOptions} [options]
* @static
* @returns {Parse.Object[]}
*/
+
static saveAll(list: Array, options: RequestOptions = {}) {
const saveOptions = {};
if (options.hasOwnProperty('useMasterKey')) {
@@ -1823,9 +1847,9 @@ class ParseObject {
* Creates a new instance of a Parse Object from a JSON representation.
*
* @param {object} json The JSON map of the Object's data
- * @param {boolean} override In single instance mode, all old server data
+ * @param {boolean} [override] In single instance mode, all old server data
* is overwritten if this is set to true
- * @param {boolean} dirty Whether the Parse.Object should set JSON keys to dirty
+ * @param {boolean} [dirty] Whether the Parse.Object should set JSON keys to dirty
* @static
* @returns {Parse.Object} A Parse.Object reference
*/
@@ -2067,7 +2091,7 @@ class ParseObject {
* query.fromLocalDatastore() or query.fromPin()
*
* @param {Array} objects A list of Parse.Object.
- * @returns {Promise} A promise that is fulfilled when the pin completes.
+ * @returns {Promise} A promise that is fulfilled when the pin completes.
* @static
*/
static pinAll(objects: Array): Promise {
@@ -2093,7 +2117,7 @@ class ParseObject {
*
* @param {string} name Name of Pin.
* @param {Array} objects A list of Parse.Object.
- * @returns {Promise} A promise that is fulfilled when the pin completes.
+ * @returns {Promise} A promise that is fulfilled when the pin completes.
* @static
*/
static pinAllWithName(name: string, objects: Array): Promise {
@@ -2113,7 +2137,7 @@ class ParseObject {
*
*
* @param {Array} objects A list of Parse.Object.
- * @returns {Promise} A promise that is fulfilled when the unPin completes.
+ * @returns {Promise} A promise that is fulfilled when the unPin completes.
* @static
*/
static unPinAll(objects: Array): Promise {
@@ -2133,7 +2157,7 @@ class ParseObject {
*
* @param {string} name Name of Pin.
* @param {Array} objects A list of Parse.Object.
- * @returns {Promise} A promise that is fulfilled when the unPin completes.
+ * @returns {Promise} A promise that is fulfilled when the unPin completes.
* @static
*/
static unPinAllWithName(name: string, objects: Array): Promise {
@@ -2151,7 +2175,7 @@ class ParseObject {
* await Parse.Object.unPinAllObjects();
*
*
- * @returns {Promise} A promise that is fulfilled when the unPin completes.
+ * @returns {Promise} A promise that is fulfilled when the unPin completes.
* @static
*/
static unPinAllObjects(): Promise {
@@ -2171,7 +2195,7 @@ class ParseObject {
*
*
* @param {string} name Name of Pin.
- * @returns {Promise} A promise that is fulfilled when the unPin completes.
+ * @returns {Promise} A promise that is fulfilled when the unPin completes.
* @static
*/
static unPinAllObjectsWithName(name: string): Promise {
diff --git a/src/ParsePolygon.js b/src/ParsePolygon.js
index b817be8a8..162b72ecd 100644
--- a/src/ParsePolygon.js
+++ b/src/ParsePolygon.js
@@ -28,13 +28,13 @@ import ParseGeoPoint from './ParseGeoPoint';
* object.set("area", polygon);
* object.save();
*
- * @alias Parse.Polygon
*/
class ParsePolygon {
_coordinates: Array>;
/**
* @param {(number[][] | Parse.GeoPoint[])} coordinates An Array of coordinate pairs
+ * @alias Parse.Polygon
*/
constructor(coordinates: Array> | Array) {
this._coordinates = ParsePolygon._validate(coordinates);
diff --git a/src/ParseQuery.js b/src/ParseQuery.js
index fe5c6f0ea..3669d0ec4 100644
--- a/src/ParseQuery.js
+++ b/src/ParseQuery.js
@@ -44,6 +44,26 @@ export type QueryJSON = {
subqueryReadPreference?: string,
};
+/**
+ * Typedef for QueryOptions
+ *
+ * @typedef QueryOptions
+ * @property {boolean} [useMasterKey] If true, sign up with masterKey
+ * @property {string} [sessionToken] sessionToken
+ * @property {any} [context] context
+ * @property {boolean} [json] json
+ */
+
+/**
+ * Typedef for BatchOptions
+ *
+ * @typedef BatchOptions
+ * @property {boolean} [useMasterKey] If true, sign up with masterKey
+ * @property {string} [sessionToken] sessionToken
+ * @property {any} [context] context
+ * @property {number} [batchSize] batchSize
+ */
+
/**
* Converts a string into a regex that matches it.
* Surrounding with \Q .. \E does this, we just need to escape any \E's in
@@ -223,7 +243,6 @@ function handleOfflineSort(a, b, sorts) {
* // error is an instance of Parse.Error.
* });
*
- * @alias Parse.Query
*/
class ParseQuery {
/**
@@ -249,8 +268,10 @@ class ParseQuery {
_xhrRequest: any;
/**
+ * @alias Parse.Query
* @param {(string | Parse.Object)} objectClass An instance of a subclass of Parse.Object, or a Parse className string.
*/
+
constructor(objectClass: string | ParseObject) {
if (typeof objectClass === 'string') {
if (objectClass === 'User' && CoreManager.get('PERFORM_USER_REWRITE')) {
@@ -359,6 +380,25 @@ class ParseQuery {
_regexStartWith(string: string): string {
return '^' + quote(string);
}
+ /**
+ * @typedef QueryJSON
+ * @property {Attributes} where
+ * @property {string} [include]
+ * @property {string} [excludeKeys]
+ * @property {string} [keys]
+ * @property {number} [limit]
+ * @property {number} [skip]
+ * @property {string} [order]
+ * @property {string} [className]
+ * @property {number} [count]
+ * @property {any} [hint]
+ * @property {boolean} [explain]
+ * @property {string} [readPreference]
+ * @property {string} [includeReadPreference]
+ *
+ * @property {string} [subqueryReadPreference]
+ *
+ */
async _handleOfflineQuery(params: any) {
OfflineQuery.validateQuery(this);
@@ -594,7 +634,7 @@ class ParseQuery {
* the server. Unlike the first method, it never returns undefined.
*
* @param {string} objectId The id of the object to be fetched.
- * @param {object} options
+ * @param {QueryOptions} [options]
* Valid options are:
*
useMasterKey: In Cloud Code and Node only, causes the Master Key to
* be used for this request.
@@ -604,7 +644,7 @@ class ParseQuery {
*
json: Return raw json without converting to Parse.Object
*
*
- * @returns {Promise} A promise that is resolved with the result when
+ * @returns {Promise} A promise that is resolved with the result when
* the query completes.
*/
get(objectId: string, options?: FullOptions): Promise {
@@ -637,7 +677,7 @@ class ParseQuery {
/**
* Retrieves a list of ParseObjects that satisfy this query.
*
- * @param {object} options Valid options
+ * @param {QueryOptions} [options] Valid options
* are:
*
useMasterKey: In Cloud Code and Node only, causes the Master Key to
* be used for this request.
@@ -647,7 +687,7 @@ class ParseQuery {
*
json: Return raw json without converting to Parse.Object
*
*
- * @returns {Promise} A promise that is resolved with the results when
+ * @returns {Promise>} A promise that is resolved with the results when
* the query completes.
*/
find(options?: FullOptions): Promise> {
@@ -712,14 +752,8 @@ class ParseQuery {
* Retrieves a complete list of ParseObjects that satisfy this query.
* Using `eachBatch` under the hood to fetch all the valid objects.
*
- * @param {object} options Valid options are:
- *
batchSize: How many objects to yield in each batch (default: 100)
- *
useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- *
sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- *
- * @returns {Promise} A promise that is resolved with the results when
+ * @param {BatchOptions} [options]
+ * @returns {Promise>} A promise that is resolved with the results when
* the query completes.
*/
async findAll(options?: BatchOptions): Promise> {
@@ -734,6 +768,8 @@ class ParseQuery {
* Counts the number of objects that match this query.
*
* @param {object} options
+ * @param {boolean} [options.useMasterKey]
+ * @param {string} [options.sessionToken]
* Valid options are:
*
useMasterKey: In Cloud Code and Node only, causes the Master Key to
* be used for this request.
@@ -741,7 +777,7 @@ class ParseQuery {
* behalf of a specific user.
*
*
- * @returns {Promise} A promise that is resolved with the count when
+ * @returns {Promise} A promise that is resolved with the count when
* the query completes.
*/
count(options?: FullOptions): Promise {
@@ -772,12 +808,9 @@ class ParseQuery {
*
* @param {string} key A field to find distinct values
* @param {object} options
- * Valid options are:
- *
sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- *
+ * @param {string} [options.sessionToken]
*
- * @returns {Promise} A promise that is resolved with the query completes.
+ * @returns {Promise>} A promise that is resolved with the query completes.
*/
distinct(key: string, options?: FullOptions): Promise> {
options = options || {};
@@ -801,16 +834,36 @@ class ParseQuery {
});
}
+ /**
+ * Typedef for Aggregation Options
+ *
+ * @typedef AggregationPipeline
+ * @property {Attributes | GroupParams} [group]
+ * @property {Attributes} [match]
+ * @property {Attributes} [project]
+ * @property {number} [limit]
+ * @property {number} [skip]
+ * @property {object.} [sort]
+ * @property {object} [sample]
+ * @property {number} [sample.size]
+ */
+
+ /**
+ * Typedef for Aggregate Group
+ *
+ * @typedef GroupParams
+ * @property {string} [objectId]
+ */
+
/**
* Executes an aggregate query and returns aggregate results
*
- * @param {(Array|object)} pipeline Array or Object of stages to process query
- * @param {object} options Valid options are:
- *
sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- *
+ * @param {AggregationPipeline} pipeline Array or Object of stages to process query
+ * @param {object} options
+ * @param {boolean} [options.useMasterKey]
+ * @param {string} [options.sessionToken]
*
- * @returns {Promise} A promise that is resolved with the query completes.
+ * @returns {Promise>} A promise that is resolved with the query completes.
*/
aggregate(pipeline: mixed, options?: FullOptions): Promise> {
options = options || {};
@@ -851,7 +904,7 @@ class ParseQuery {
*
* Returns the object if there is one, otherwise undefined.
*
- * @param {object} options Valid options are:
useMasterKey: In Cloud Code and Node only, causes the Master Key to
* be used for this request.
*
sessionToken: A valid session token, used for making a request on
@@ -860,7 +913,7 @@ class ParseQuery {
*
json: Return raw json without converting to Parse.Object
*
*
- * @returns {Promise} A promise that is resolved with the object when
+ * @returns {Promise} A promise that is resolved with the object when
* the query completes.
*/
first(options?: FullOptions): Promise {
@@ -927,15 +980,8 @@ class ParseQuery {
*
* @param {Function} callback Callback that will be called with each result
* of the query.
- * @param {object} options Valid options are:
- *
batchSize: How many objects to yield in each batch (default: 100)
- *
useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- *
sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- *
context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
- *
- * @returns {Promise} A promise that will be fulfilled once the
+ * @param {BatchOptions} [options]
+ * @returns {Promise} A promise that will be fulfilled once the
* iteration has completed.
*/
eachBatch(
@@ -1025,13 +1071,8 @@ class ParseQuery {
*
* @param {Function} callback Callback that will be called with each result
* of the query.
- * @param {object} options Valid options are:
- *
useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- *
sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- *
- * @returns {Promise} A promise that will be fulfilled once the
+ * @param {BatchOptions} [options]
+ * @returns {Promise} A promise that will be fulfilled once the
* iteration has completed.
*/
each(callback: (obj: ParseObject) => any, options?: BatchOptions): Promise {
@@ -1088,13 +1129,13 @@ class ParseQuery {
*
useMasterKey: In Cloud Code and Node only, causes the Master Key to
* be used for this request.
*
sessionToken: A valid session token, used for making a request on
* behalf of a specific user.
*
- * @returns {Promise} A promise that will be fulfilled once the
+ * @returns {Promise>} A promise that will be fulfilled once the
* iteration has completed.
*/
async map(
@@ -1126,13 +1167,8 @@ class ParseQuery {
*
index: The index of the current Parse.Object being processed in the array.
*
* @param {*} initialValue A value to use as the first argument to the first call of the callback. If no initialValue is supplied, the first object in the query will be used and skipped.
- * @param {object} options Valid options are:
- *
useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- *
sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- *
- * @returns {Promise} A promise that will be fulfilled once the
+ * @param {BatchOptions} [options]
+ * @returns {Promise>} A promise that will be fulfilled once the
* iteration has completed.
*/
async reduce(
@@ -1177,13 +1213,8 @@ class ParseQuery {
*
useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- *
sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- *
- * @returns {Promise} A promise that will be fulfilled once the
+ * @param {BatchOptions} [options] batch options
+ * @returns {Promise>} A promise that will be fulfilled once the
* iteration has completed.
*/
async filter(
@@ -1386,7 +1417,7 @@ class ParseQuery {
*
* @param {string} key The key that the string to match is stored in.
* @param {RegExp} regex The regular expression pattern to match.
- * @param {string} modifiers The regular expression mode.
+ * @param {string} [modifiers] The regular expression mode.
* @returns {Parse.Query} Returns the query, so you can chain this call.
*/
matches(key: string, regex: RegExp, modifiers: string): ParseQuery {
@@ -1491,6 +1522,15 @@ class ParseQuery {
return this._addCondition(key, '$regex', quote(substring));
}
+ /**
+ * Typedef for Full Text Options
+ *
+ * @typedef FullTextOptions
+ * @property {string} language The language that determines the list of stop words for the search and the rules for the stemmer and tokenizer.
+ * @property {boolean} caseSensitive A boolean flag to enable or disable case sensitive search.
+ * @property {boolean} diacriticSensitive A boolean flag to enable or disable diacritic sensitive search.
+ */
+
/**
* Adds a constraint for finding string values that contain a provided
* string. This may be slow for large datasets. Requires Parse-Server > 2.5.0
@@ -1514,10 +1554,7 @@ class ParseQuery {
*
* @param {string} key The key that the string to match is stored in.
* @param {string} value The string to search
- * @param {object} options (Optional)
- * @param {string} options.language The language that determines the list of stop words for the search and the rules for the stemmer and tokenizer.
- * @param {boolean} options.caseSensitive A boolean flag to enable or disable case sensitive search.
- * @param {boolean} options.diacriticSensitive A boolean flag to enable or disable diacritic sensitive search.
+ * @param {FullTextOptions} [options] The full text options
* @returns {Parse.Query} Returns the query, so you can chain this call.
*/
fullText(key: string, value: string, options: ?Object): ParseQuery {
@@ -1573,7 +1610,7 @@ class ParseQuery {
*
* @param {string} key The key that the string to match is stored in.
* @param {string} prefix The substring that the value must start with.
- * @param {string} modifiers The regular expression mode.
+ * @param {string} [modifiers] The regular expression mode.
* @returns {Parse.Query} Returns the query, so you can chain this call.
*/
startsWith(key: string, prefix: string, modifiers: string): ParseQuery {
@@ -1622,7 +1659,7 @@ class ParseQuery {
* @param {string} key The key that the Parse.GeoPoint is stored in.
* @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
* @param {number} maxDistance Maximum distance (in radians) of results to return.
- * @param {boolean} sorted A Bool value that is true if results should be
+ * @param {boolean} [sorted] A Bool value that is true if results should be
* sorted by distance ascending, false is no sorting is required,
* defaults to true.
* @returns {Parse.Query} Returns the query, so you can chain this call.
@@ -1651,7 +1688,7 @@ class ParseQuery {
* @param {string} key The key that the Parse.GeoPoint is stored in.
* @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
* @param {number} maxDistance Maximum distance (in miles) of results to return.
- * @param {boolean} sorted A Bool value that is true if results should be
+ * @param {boolean} [sorted] A Bool value that is true if results should be
* sorted by distance ascending, false is no sorting is required,
* defaults to true.
* @returns {Parse.Query} Returns the query, so you can chain this call.
@@ -1668,7 +1705,7 @@ class ParseQuery {
* @param {string} key The key that the Parse.GeoPoint is stored in.
* @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
* @param {number} maxDistance Maximum distance (in kilometers) of results to return.
- * @param {boolean} sorted A Bool value that is true if results should be
+ * @param {boolean} [sorted] A Bool value that is true if results should be
* sorted by distance ascending, false is no sorting is required,
* defaults to true.
* @returns {Parse.Query} Returns the query, so you can chain this call.
@@ -1845,7 +1882,7 @@ class ParseQuery {
* Sets the flag to include with response the total number of objects satisfying this query,
* despite limits/skip. Might be useful for pagination.
* Note that result of this query will be wrapped as an object with
- * `results`: holding {ParseObject} array and `count`: integer holding total number
+ * `results`: holding {Parse.Object} array and `count`: integer holding total number
*
* @param {boolean} includeCount false - disable, true - enable.
* @returns {Parse.Query} Returns the query, so you can chain this call.
@@ -1865,9 +1902,12 @@ class ParseQuery {
* Requires Parse Server 3.0.0+
*
query.include('*');
*
+ *
* @param {...string|Array} keys The name(s) of the key(s) to include.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
+ * @returns {this} Returns the query, so you can chain this call.
+ *
*/
+
include(...keys: Array>): ParseQuery {
keys.forEach(key => {
if (Array.isArray(key)) {
@@ -1954,7 +1994,7 @@ class ParseQuery {
/**
* Subscribe this query to get liveQuery updates
*
- * @param {string} sessionToken (optional) Defaults to the currentUser
+ * @param {string} [sessionToken] (optional) Defaults to the currentUser
* @returns {Promise} Returns the liveQuerySubscription, it's an event emitter
* which can be used to get liveQuery updates.
*/
diff --git a/src/ParseRelation.js b/src/ParseRelation.js
index e467c92c2..04482b434 100644
--- a/src/ParseRelation.js
+++ b/src/ParseRelation.js
@@ -24,7 +24,6 @@ import ParseQuery from './ParseQuery';
* particular parent object and key.
*
*
- * @alias Parse.Relation
*/
class ParseRelation {
parent: ?ParseObject;
@@ -32,6 +31,7 @@ class ParseRelation {
targetClassName: ?string;
/**
+ * @alias Parse.Relation
* @param {Parse.Object} parent The parent of this relation.
* @param {string} key The key for this relation on the parent.
*/
diff --git a/src/ParseRole.js b/src/ParseRole.js
index 07d4c8fa2..8a4125c7e 100644
--- a/src/ParseRole.js
+++ b/src/ParseRole.js
@@ -26,16 +26,17 @@ import type ParseRelation from './ParseRelation';
*
Roles must have a name (which cannot be changed after creation of the
* role), and must specify an ACL.
*
- * @alias Parse.Role
- * @augments Parse.Object
*/
class ParseRole extends ParseObject {
/**
+ * @augments Parse.Object
+ * @alias Parse.Role
* @param {string} name The name of the Role to create.
* @param {Parse.ACL} acl The ACL for this role. Roles must have an ACL.
* A Parse.Role is a local representation of a role persisted to the Parse
* cloud.
*/
+
constructor(name: string, acl: ParseACL) {
super('_Role');
if (typeof name === 'string' && acl instanceof ParseACL) {
@@ -72,7 +73,7 @@ class ParseRole extends ParseObject {
* @param {string} name The name of the role.
* @param {object} options Standard options object with success and error
* callbacks.
- * @returns {(ParseObject|boolean)} true if the set succeeded.
+ * @returns {(Parse.Object|boolean)} true if the set succeeded.
*/
setName(name: string, options?: mixed): ParseObject | boolean {
return this.set('name', name, options);
diff --git a/src/ParseSchema.js b/src/ParseSchema.js
index 49c717f0d..2ba60ecfc 100644
--- a/src/ParseSchema.js
+++ b/src/ParseSchema.js
@@ -34,6 +34,14 @@ type FieldOptions = {
defaultValue: mixed,
};
+/**
+ * Typedef for FieldOptions
+ *
+ * @typedef FieldOptions
+ * @property {boolean} [required] Whether the field is required
+ * @property {any} [defaultValue] Default value for the field
+ */
+
/**
* A Parse.Schema object is for handling schema data from Parse.
*
All the schemas methods require MasterKey.
@@ -49,7 +57,6 @@ type FieldOptions = {
*
*
*
- * @alias Parse.Schema
*/
class ParseSchema {
className: string;
@@ -58,6 +65,7 @@ class ParseSchema {
_clp: { [key: string]: mixed };
/**
+ * @alias Parse.Schema
* @param {string} className Parse Class string.
*/
constructor(className: string) {
@@ -76,7 +84,7 @@ class ParseSchema {
/**
* Static method to get all schemas
*
- * @returns {Promise} A promise that is resolved with the result when
+ * @returns {Promise} A promise that is resolved with the result when
* the query completes.
*/
static all() {
@@ -92,7 +100,7 @@ class ParseSchema {
/**
* Get the Schema from Parse
*
- * @returns {Promise} A promise that is resolved with the result when
+ * @returns {Promise} A promise that is resolved with the result when
* the query completes.
*/
get() {
@@ -110,7 +118,7 @@ class ParseSchema {
/**
* Create a new Schema on Parse
*
- * @returns {Promise} A promise that is resolved with the result when
+ * @returns {Promise} A promise that is resolved with the result when
* the query completes.
*/
save() {
@@ -130,7 +138,7 @@ class ParseSchema {
/**
* Update a Schema on Parse
*
- * @returns {Promise} A promise that is resolved with the result when
+ * @returns {Promise} A promise that is resolved with the result when
* the query completes.
*/
update() {
@@ -154,7 +162,7 @@ class ParseSchema {
* Removing a Schema from Parse
* Can only be used on Schema without objects
*
- * @returns {Promise} A promise that is resolved with the result when
+ * @returns {Promise} A promise that is resolved with the result when
* the query completes.
*/
delete() {
@@ -168,7 +176,7 @@ class ParseSchema {
* Removes all objects from a Schema (class) in Parse.
* EXERCISE CAUTION, running this will delete all objects for this schema and cannot be reversed
*
- * @returns {Promise} A promise that is resolved with the result when
+ * @returns {Promise} A promise that is resolved with the result when
* the query completes.
*/
purge() {
@@ -209,8 +217,8 @@ class ParseSchema {
* Adding a Field to Create / Update a Schema
*
* @param {string} name Name of the field that will be created on Parse
- * @param {string} type Can be a (String|Number|Boolean|Date|Parse.File|Parse.GeoPoint|Array|Object|Pointer|Parse.Relation)
- * @param {object} options
+ * @param {string} [type] Can be a (String|Number|Boolean|Date|Parse.File|Parse.GeoPoint|Array|Object|Pointer|Parse.Relation)
+ * @param {FieldOptions} [options]
* Valid options are:
*
required: If field is not set, save operation fails (Requires Parse Server 3.7.0+)
*
defaultValue: If field is not set, a default value is selected (Requires Parse Server 3.7.0+)
@@ -273,7 +281,7 @@ class ParseSchema {
* Adding String Field
*
* @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
+ * @param {FieldOptions} [options] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
*/
addString(name: string, options: FieldOptions) {
@@ -284,7 +292,7 @@ class ParseSchema {
* Adding Number Field
*
* @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
+ * @param {FieldOptions} [options] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
*/
addNumber(name: string, options: FieldOptions) {
@@ -295,7 +303,7 @@ class ParseSchema {
* Adding Boolean Field
*
* @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
+ * @param {FieldOptions} [options] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
*/
addBoolean(name: string, options: FieldOptions) {
@@ -306,7 +314,7 @@ class ParseSchema {
* Adding Date Field
*
* @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
+ * @param {FieldOptions} [options] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
*/
addDate(name: string, options: FieldOptions) {
@@ -323,7 +331,7 @@ class ParseSchema {
* Adding File Field
*
* @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
+ * @param {FieldOptions} [options] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
*/
addFile(name: string, options: FieldOptions) {
@@ -334,7 +342,7 @@ class ParseSchema {
* Adding GeoPoint Field
*
* @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
+ * @param {FieldOptions} [options] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
*/
addGeoPoint(name: string, options: FieldOptions) {
@@ -345,7 +353,7 @@ class ParseSchema {
* Adding Polygon Field
*
* @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
+ * @param {FieldOptions} [options] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
*/
addPolygon(name: string, options: FieldOptions) {
@@ -356,7 +364,7 @@ class ParseSchema {
* Adding Array Field
*
* @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
+ * @param {FieldOptions} [options] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
*/
addArray(name: string, options: FieldOptions) {
@@ -367,7 +375,7 @@ class ParseSchema {
* Adding Object Field
*
* @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
+ * @param {FieldOptions} [options] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
*/
addObject(name: string, options: FieldOptions) {
@@ -379,7 +387,7 @@ class ParseSchema {
*
* @param {string} name Name of the field that will be created on Parse
* @param {string} targetClass Name of the target Pointer Class
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
+ * @param {FieldOptions} [options] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
*/
addPointer(name: string, targetClass: string, options: FieldOptions = {}) {
diff --git a/src/ParseSession.js b/src/ParseSession.js
index 1b1d8d108..dc25509f8 100644
--- a/src/ParseSession.js
+++ b/src/ParseSession.js
@@ -22,12 +22,12 @@ import type { RequestOptions, FullOptions } from './RESTController';
* This class is a subclass of a Parse.Object, and retains the same
* functionality of a Parse.Object.
*
- * @alias Parse.Session
- * @augments Parse.Object
*/
class ParseSession extends ParseObject {
/**
- * @param {object} attributes The initial set of data to store in the user.
+ * @augments Parse.Object
+ * @alias Parse.Session
+ * @param {object} [attributes] The initial set of data to store in the user.
*/
constructor(attributes: ?AttributeMap) {
super('_Session');
@@ -60,7 +60,7 @@ class ParseSession extends ParseObject {
*
* @param {object} options useMasterKey
* @static
- * @returns {Promise} A promise that is resolved with the Parse.Session
+ * @returns {Promise} A promise that is resolved with the Parse.Session
* object after it has been fetched. If there is no current user, the
* promise will be rejected.
*/
diff --git a/src/ParseUser.js b/src/ParseUser.js
index d0303dac3..a80689927 100644
--- a/src/ParseUser.js
+++ b/src/ParseUser.js
@@ -34,13 +34,19 @@ const authProviders = {};
* same functionality of a Parse.Object, but also extends it with various
* user specific methods, like authentication, signing up, and validation of
* uniqueness.
- *
- * @alias Parse.User
- * @augments Parse.Object
*/
+
class ParseUser extends ParseObject {
/**
- * @param {object} attributes The initial set of data to store in the user.
+ *
A Parse.User object is a local representation of a user persisted to the
+ * Parse cloud. This class is a subclass of a Parse.Object, and retains the
+ * same functionality of a Parse.Object, but also extends it with various
+ * user specific methods, like authentication, signing up, and validation of
+ * uniqueness.
+ *
+ * @augments Parse.Object
+ * @alias Parse.User
+ * @param {object} [attributes] The initial set of data to store in the user.
*/
constructor(attributes: ?AttributeMap) {
super('_User');
@@ -55,7 +61,7 @@ class ParseUser extends ParseObject {
* Request a revocable session token to replace the older style of token.
*
* @param {object} options
- * @returns {Promise} A promise that is resolved when the replacement
+ * @returns {Promise} A promise that is resolved when the replacement
* token has been fetched.
*/
_upgradeToRevocableSession(options: RequestOptions): Promise {
@@ -82,9 +88,10 @@ class ParseUser extends ParseObject {
*
If provider is string, options is {@link http://docs.parseplatform.org/parse-server/guide/#supported-3rd-party-authentications authData}
*
If provider is AuthProvider, options is saveOpts
*
- * @param {object} saveOpts useMasterKey / sessionToken
- * @returns {Promise} A promise that is fulfilled with the user is linked
+ * @param {object} [saveOpts] useMasterKey / sessionToken
+ * @returns {Promise} A promise that is fulfilled with the user is linked
*/
+
linkWith(
provider: any,
options: { authData?: AuthData },
@@ -148,7 +155,7 @@ class ParseUser extends ParseObject {
* @param options
* @param saveOpts
* @deprecated since 2.9.0 see {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith}
- * @returns {Promise}
+ * @returns {Promise}
*/
_linkWith(
provider: any,
@@ -222,8 +229,8 @@ class ParseUser extends ParseObject {
* Unlinks a user from a service.
*
* @param {string | AuthProvider} provider Name of auth provider or {@link https://parseplatform.org/Parse-SDK-JS/api/master/AuthProvider.html AuthProvider}
- * @param {object} options MasterKey / SessionToken
- * @returns {Promise} A promise that is fulfilled when the unlinking
+ * @param {FullOptions} [options] MasterKey / SessionToken
+ * @returns {Promise} A promise that is fulfilled when the unlinking
* finishes.
*/
_unlinkFrom(provider: any, options?: FullOptions): Promise {
@@ -411,10 +418,13 @@ class ParseUser extends ParseObject {
*
A username and password must be set before calling signUp.
*
* @param {object} attrs Extra fields to set on the new user, or null.
- * @param {object} options
- * @returns {Promise} A promise that is fulfilled when the signup
+ * @param {object} [options]
+ * @param {boolean} [options.useMasterKey]
+ * @param {string} [options.sessionToken]
+ * @returns {Promise} A promise that is fulfilled when the signup
* finishes.
*/
+
signUp(attrs: AttributeMap, options?: FullOptions): Promise {
options = options || {};
@@ -437,10 +447,11 @@ class ParseUser extends ParseObject {
*
*
A username and password must be set before calling logIn.
*
- * @param {object} options
- * @returns {Promise} A promise that is fulfilled with the user when
+ * @param {FullOptions} [options]
+ * @returns {Promise} A promise that is fulfilled with the user when
* the login is complete.
*/
+
logIn(options?: FullOptions): Promise {
options = options || {};
@@ -464,7 +475,7 @@ class ParseUser extends ParseObject {
* storage if this is current user.
*
* @param {...any} args
- * @returns {Promise}
+ * @returns {Promise}
*/
async save(...args: Array): Promise {
await super.save.apply(this, args);
@@ -480,7 +491,7 @@ class ParseUser extends ParseObject {
* the current user when it is destroyed
*
* @param {...any} args
- * @returns {Parse.User}
+ * @returns {Promise}
*/
async destroy(...args: Array): Promise {
await super.destroy.apply(this, args);
@@ -496,7 +507,7 @@ class ParseUser extends ParseObject {
* storage if this is current user.
*
* @param {...any} args
- * @returns {Parse.User}
+ * @returns {Promise}
*/
async fetch(...args: Array): Promise {
await super.fetch.apply(this, args);
@@ -512,7 +523,7 @@ class ParseUser extends ParseObject {
* storage if this is current user.
*
* @param {...any} args
- * @returns {Parse.User}
+ * @returns {Promise}
*/
async fetchWithInclude(...args: Array): Promise {
await super.fetchWithInclude.apply(this, args);
@@ -528,7 +539,7 @@ class ParseUser extends ParseObject {
*
* @param {string} password A password to be verified
* @param {object} options
- * @returns {Promise} A promise that is fulfilled with a user
+ * @returns {Promise} A promise that is fulfilled with a user
* when the password is correct.
*/
verifyPassword(password: string, options?: RequestOptions): Promise {
@@ -584,7 +595,7 @@ class ParseUser extends ParseObject {
* either from memory or localStorage, if necessary.
*
* @static
- * @returns {Parse.Object} The currently logged in Parse.User.
+ * @returns {Parse.User} The currently logged in Parse.User.
*/
static current(): ?ParseUser {
if (!canUseCurrentUser) {
@@ -598,7 +609,7 @@ class ParseUser extends ParseObject {
* Retrieves the currently logged in ParseUser from asynchronous Storage.
*
* @static
- * @returns {Promise} A Promise that is resolved with the currently
+ * @returns {Promise} A Promise that is resolved with the currently
* logged in Parse User
*/
static currentAsync(): Promise {
@@ -620,7 +631,7 @@ class ParseUser extends ParseObject {
* @param {object} attrs Extra fields to set on the new user.
* @param {object} options
* @static
- * @returns {Promise} A promise that is fulfilled with the user when
+ * @returns {Promise} A promise that is fulfilled with the user when
* the signup completes.
*/
static signUp(username: string, password: string, attrs: AttributeMap, options?: FullOptions) {
@@ -638,9 +649,9 @@ class ParseUser extends ParseObject {
*
* @param {string} username The username (or email) to log in with.
* @param {string} password The password to log in with.
- * @param {object} options
+ * @param {FullOptions} [options]
* @static
- * @returns {Promise} A promise that is fulfilled with the user when
+ * @returns {Promise} A promise that is fulfilled with the user when
* the login completes.
*/
static logIn(username: string, password: string, options?: FullOptions) {
@@ -660,9 +671,9 @@ class ParseUser extends ParseObject {
* current.
*
* @param {string} sessionToken The sessionToken to log in with.
- * @param {object} options
+ * @param {RequestOptions} [options]
* @static
- * @returns {Promise} A promise that is fulfilled with the user when
+ * @returns {Promise} A promise that is fulfilled with the user when
* the login completes.
*/
static become(sessionToken: string, options?: RequestOptions) {
@@ -689,7 +700,7 @@ class ParseUser extends ParseObject {
* @param {string} sessionToken The sessionToken to get user with.
* @param {object} options
* @static
- * @returns {Promise} A promise that is fulfilled with the user is fetched.
+ * @returns {Promise} A promise that is fulfilled with the user is fetched.
*/
static me(sessionToken: string, options?: RequestOptions = {}) {
const controller = CoreManager.getUserController();
@@ -710,7 +721,7 @@ class ParseUser extends ParseObject {
*
* @param {object} userJSON The JSON map of the User's data
* @static
- * @returns {Promise} A promise that is fulfilled with the user when
+ * @returns {Promise} A promise that is fulfilled with the user when
* the login completes.
*/
static hydrate(userJSON: AttributeMap) {
@@ -726,7 +737,7 @@ class ParseUser extends ParseObject {
* @param options
* @param saveOpts
* @static
- * @returns {Promise}
+ * @returns {Promise}
*/
static logInWith(
provider: any,
@@ -742,9 +753,9 @@ class ParseUser extends ParseObject {
* session from disk, log out of linked services, and future calls to
* current will return null.
*
- * @param {object} options
+ * @param {RequestOptions} [options]
* @static
- * @returns {Promise} A promise that is resolved when the session is
+ * @returns {Promise} A promise that is resolved when the session is
* destroyed on the server.
*/
static logOut(options: RequestOptions = {}) {
@@ -759,9 +770,9 @@ class ParseUser extends ParseObject {
*
* @param {string} email The email address associated with the user that
* forgot their password.
- * @param {object} options
+ * @param {RequestOptions} [options]
* @static
- * @returns {Promise}
+ * @returns {Promise}
*/
static requestPasswordReset(email: string, options?: RequestOptions) {
options = options || {};
@@ -780,9 +791,9 @@ class ParseUser extends ParseObject {
*
* @param {string} email The email address associated with the user that
* forgot their password.
- * @param {object} options
+ * @param {RequestOptions} [options]
* @static
- * @returns {Promise}
+ * @returns {Promise}
*/
static requestEmailVerification(email: string, options?: RequestOptions) {
options = options || {};
@@ -803,7 +814,7 @@ class ParseUser extends ParseObject {
* @param {string} password A password to be verified
* @param {object} options
* @static
- * @returns {Promise} A promise that is fulfilled with a user
+ * @returns {Promise} A promise that is fulfilled with a user
* when the password is correct.
*/
static verifyPassword(username: string, password: string, options?: RequestOptions) {
@@ -849,7 +860,7 @@ class ParseUser extends ParseObject {
*
* @param {object} options
* @static
- * @returns {Promise} A promise that is resolved when the process has
+ * @returns {Promise} A promise that is resolved when the process has
* completed. If a replacement session token is requested, the promise
* will be resolved after a new token has been fetched.
*/
@@ -915,7 +926,7 @@ class ParseUser extends ParseObject {
* @param saveOpts
* @deprecated since 2.9.0 see {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#logInWith logInWith}
* @static
- * @returns {Promise}
+ * @returns {Promise}
*/
static _logInWith(provider: any, options: { authData?: AuthData }, saveOpts?: FullOptions) {
const user = new this();
diff --git a/src/Push.js b/src/Push.js
index 4ef1006c8..444b23023 100644
--- a/src/Push.js
+++ b/src/Push.js
@@ -55,7 +55,7 @@ export type PushData = {
*
Parse.Analytics provides an interface to Parse's logging and analytics
+ * backend.
+ */
+ class Analytics {
+ /**
+ *
Tracks the occurrence of a custom event with additional dimensions.
+ * Parse will store a data point at the time of invocation with the given
+ * event name.
+ *
Dimensions will allow segmentation of the occurrences of this custom
+ * event. Keys and values should be {@code String}s, and will throw
+ * otherwise.
+ *
To track a user signup along with additional metadata, consider the
+ * following: