+ *
+ * There is a default limit of 8 dimensions per event tracked.
+ *
+ * @function track
+ * @name Parse.Analytics.track
+ * @param {string} name The name of the custom event to report to Parse as
+ * having happened.
+ * @param {object} dimensions The dictionary of information by which to
+ * segment this event.
+ * @returns {Promise} A promise that is resolved when the round-trip
+ * to the server completes.
+ */
+export function track(name: string, dimensions: {
+ [key: string]: string;
+}): Promise;
diff --git a/types/AnonymousUtils.d.ts b/types/AnonymousUtils.d.ts
new file mode 100644
index 000000000..8637c2083
--- /dev/null
+++ b/types/AnonymousUtils.d.ts
@@ -0,0 +1,56 @@
+export default AnonymousUtils;
+declare namespace AnonymousUtils {
+ /**
+ * Gets whether the user has their account linked to anonymous user.
+ *
+ * @function isLinked
+ * @name Parse.AnonymousUtils.isLinked
+ * @param {Parse.User} user User to check for.
+ * The user must be logged in on this device.
+ * @returns {boolean} true if the user has their account
+ * linked to an anonymous user.
+ * @static
+ */
+ function isLinked(user: ParseUser): boolean;
+ /**
+ * Logs in a user Anonymously.
+ *
+ * @function logIn
+ * @name Parse.AnonymousUtils.logIn
+ * @param {object} options MasterKey / SessionToken.
+ * @returns {Promise} Logged in user
+ * @static
+ */
+ function logIn(options?: RequestOptions): Promise;
+ /**
+ * Links Anonymous User to an existing PFUser.
+ *
+ * @function link
+ * @name Parse.AnonymousUtils.link
+ * @param {Parse.User} user User to link. This must be the current user.
+ * @param {object} options MasterKey / SessionToken.
+ * @returns {Promise} Linked with User
+ * @static
+ */
+ function link(user: ParseUser, options?: RequestOptions): Promise;
+ /**
+ * Returns true if Authentication Provider has been registered for use.
+ *
+ * @function isRegistered
+ * @name Parse.AnonymousUtils.isRegistered
+ * @returns {boolean}
+ * @static
+ */
+ function isRegistered(): boolean;
+ function _getAuthProvider(): {
+ restoreAuthentication(): boolean;
+ getAuthType(): string;
+ getAuthData(): {
+ authData: {
+ id: any;
+ };
+ };
+ };
+}
+import ParseUser from './ParseUser';
+import { RequestOptions } from './RESTController';
diff --git a/types/Cloud.d.ts b/types/Cloud.d.ts
new file mode 100644
index 000000000..e47654fb3
--- /dev/null
+++ b/types/Cloud.d.ts
@@ -0,0 +1,54 @@
+/**
+ * Contains functions for calling and declaring
+ * cloud functions.
+ *
+ * Some functions are only available from Cloud Code.
+ *
+ *
+ * @class Parse.Cloud
+ * @static
+ * @hideconstructor
+ */
+/**
+ * Makes a call to a cloud function.
+ *
+ * @function run
+ * @name Parse.Cloud.run
+ * @param {string} name The function name.
+ * @param {object} data The parameters to send to the cloud function.
+ * @param {object} options
+ * @returns {Promise} A promise that will be resolved with the result
+ * of the function.
+ */
+export function run(name: string, data: mixed, options: RequestOptions): Promise;
+/**
+ * Gets data for the current set of cloud jobs.
+ *
+ * @function getJobsData
+ * @name Parse.Cloud.getJobsData
+ * @returns {Promise} A promise that will be resolved with the result
+ * of the function.
+ */
+export function getJobsData(): Promise
+ *
+ *
Open Event - When you call query.subscribe(), we send a subscribe request to
+ * the LiveQuery server, when we get the confirmation from the LiveQuery server,
+ * this event will be emitted. When the client loses WebSocket connection to the
+ * LiveQuery server, we will try to auto reconnect the LiveQuery server. If we
+ * reconnect the LiveQuery server and successfully resubscribe the ParseQuery,
+ * you'll also get this event.
+ *
+ *
Create Event - When a new ParseObject is created and it fulfills the ParseQuery you subscribe,
+ * you'll get this event. The object is the ParseObject which is created.
+ *
+ *
Update Event - When an existing ParseObject (original) which fulfills the ParseQuery you subscribe
+ * is updated (The ParseObject fulfills the ParseQuery before and after changes),
+ * you'll get this event. The object is the ParseObject which is updated.
+ * Its content is the latest value of the ParseObject.
+ *
+ * Parse-Server 3.1.3+ Required for original object parameter
+ *
+ *
Enter Event - When an existing ParseObject's (original) old value doesn't fulfill the ParseQuery
+ * but its new value fulfills the ParseQuery, you'll get this event. The object is the
+ * ParseObject which enters the ParseQuery. Its content is the latest value of the ParseObject.
+ *
+ * Parse-Server 3.1.3+ Required for original object parameter
+ *
+ *
Update Event - When an existing ParseObject's old value fulfills the ParseQuery but its new value
+ * doesn't fulfill the ParseQuery, you'll get this event. The object is the ParseObject
+ * which leaves the ParseQuery. Its content is the latest value of the ParseObject.
+ *
+ *
Delete Event - When an existing ParseObject which fulfills the ParseQuery is deleted, you'll
+ * get this event. The object is the ParseObject which is deleted.
+ *
+ *
Close Event - When the client loses the WebSocket connection to the LiveQuery
+ * server and we stop receiving events, you'll get this event.
+ *
+ *
+ * subscription.on('close', () => {
+ *
+ * });
+ *
+ * @alias Parse.LiveQuerySubscription
+ */
+declare class Subscription {
+ constructor(id: any, query: any, sessionToken: any);
+ id: any;
+ query: any;
+ sessionToken: any;
+ subscribePromise: Promise;
+ unsubscribePromise: Promise;
+ subscribed: boolean;
+ /**
+ * Close the subscription
+ *
+ * @returns {Promise}
+ */
+ unsubscribe(): Promise;
+}
diff --git a/types/LocalDatastore.d.ts b/types/LocalDatastore.d.ts
new file mode 100644
index 000000000..cb0ff5c3b
--- /dev/null
+++ b/types/LocalDatastore.d.ts
@@ -0,0 +1 @@
+export {};
diff --git a/types/LocalDatastoreController.d.ts b/types/LocalDatastoreController.d.ts
new file mode 100644
index 000000000..cb0ff5c3b
--- /dev/null
+++ b/types/LocalDatastoreController.d.ts
@@ -0,0 +1 @@
+export {};
diff --git a/types/LocalDatastoreController.react-native.d.ts b/types/LocalDatastoreController.react-native.d.ts
new file mode 100644
index 000000000..cb0ff5c3b
--- /dev/null
+++ b/types/LocalDatastoreController.react-native.d.ts
@@ -0,0 +1 @@
+export {};
diff --git a/types/LocalDatastoreUtils.d.ts b/types/LocalDatastoreUtils.d.ts
new file mode 100644
index 000000000..3fba166c3
--- /dev/null
+++ b/types/LocalDatastoreUtils.d.ts
@@ -0,0 +1,8 @@
+/**
+ * @flow
+ * @private
+ */
+export const DEFAULT_PIN: "_default";
+export const PIN_PREFIX: "parsePin_";
+export const OBJECT_PREFIX: "Parse_LDS_";
+export function isLocalDatastoreKey(key: string): boolean;
diff --git a/types/ObjectStateMutations.d.ts b/types/ObjectStateMutations.d.ts
new file mode 100644
index 000000000..a40ea402f
--- /dev/null
+++ b/types/ObjectStateMutations.d.ts
@@ -0,0 +1,27 @@
+export function defaultState(): State;
+export function setServerData(serverData: AttributeMap, attributes: AttributeMap): void;
+export function setPendingOp(pendingOps: Array, attr: string, op: Op | null): void;
+export function pushPendingState(pendingOps: Array): void;
+export function popPendingState(pendingOps: Array): OpsMap;
+export function mergeFirstPendingState(pendingOps: Array): void;
+export function estimateAttribute(serverData: AttributeMap, pendingOps: Array, className: string, id: string | null, attr: string): mixed;
+export function estimateAttributes(serverData: AttributeMap, pendingOps: Array, className: string, id: string | null): AttributeMap;
+export function commitServerChanges(serverData: AttributeMap, objectCache: ObjectCache, changes: AttributeMap): void;
+type AttributeMap = {
+ [attr: string]: any;
+};
+type OpsMap = {
+ [attr: string]: Op;
+};
+type ObjectCache = {
+ [attr: string]: string;
+};
+type State = {
+ serverData: AttributeMap;
+ pendingOps: OpsMap[];
+ objectCache: ObjectCache;
+ tasks: TaskQueue;
+ existed: boolean;
+};
+import { Op } from './ParseOp';
+export {};
diff --git a/types/OfflineQuery.d.ts b/types/OfflineQuery.d.ts
new file mode 100644
index 000000000..8c8c81b16
--- /dev/null
+++ b/types/OfflineQuery.d.ts
@@ -0,0 +1,17 @@
+export type RelativeTimeToDateResult = {
+ /**
+ * The conversion status, `error` if conversion failed or
+ * `success` if conversion succeeded.
+ */
+ status: string;
+ /**
+ * The error message if conversion failed, or the relative
+ * time indication (`past`, `present`, `future`) if conversion succeeded.
+ */
+ info: string;
+ /**
+ * The converted date, or `undefined` if conversion
+ * failed.
+ */
+ result: Date | undefined;
+};
diff --git a/types/Parse.d.ts b/types/Parse.d.ts
new file mode 100644
index 000000000..db3020c86
--- /dev/null
+++ b/types/Parse.d.ts
@@ -0,0 +1,103 @@
+import EventuallyQueue from './EventuallyQueue';
+import * as ParseOp from './ParseOp';
+import ACL from './ParseACL';
+import * as Analytics from './Analytics';
+import AnonymousUtils from './AnonymousUtils';
+import * as Cloud from './Cloud';
+import CLP from './ParseCLP';
+import CoreManager from './CoreManager';
+import Config from './ParseConfig';
+import ParseError from './ParseError';
+import FacebookUtils from './FacebookUtils';
+import File from './ParseFile';
+import GeoPoint from './ParseGeoPoint';
+import Polygon from './ParsePolygon';
+import Installation from './ParseInstallation';
+import LocalDatastore from './LocalDatastore';
+import Object from './ParseObject';
+import * as Push from './Push';
+import Query from './ParseQuery';
+import Relation from './ParseRelation';
+import Role from './ParseRole';
+import Schema from './ParseSchema';
+import Session from './ParseSession';
+import Storage from './Storage';
+import User from './ParseUser';
+import LiveQuery from './ParseLiveQuery';
+import LiveQueryClient from './LiveQueryClient';
+/**
+ * Contains all Parse API classes and functions.
+ *
+ * @static
+ * @global
+ * @class
+ * @hideconstructor
+*/
+interface ParseType {
+ ACL: typeof ACL;
+ Parse?: ParseType;
+ Analytics: typeof Analytics;
+ AnonymousUtils: typeof AnonymousUtils;
+ Cloud: typeof Cloud;
+ CLP: typeof CLP;
+ CoreManager: typeof CoreManager;
+ Config: typeof Config;
+ Error: typeof ParseError;
+ EventuallyQueue: typeof EventuallyQueue;
+ FacebookUtils: typeof FacebookUtils;
+ File: typeof File;
+ GeoPoint: typeof GeoPoint;
+ Hooks?: any;
+ Polygon: typeof Polygon;
+ Installation: typeof Installation;
+ LocalDatastore: typeof LocalDatastore;
+ Object: typeof Object;
+ Op: {
+ Set: typeof ParseOp.SetOp;
+ Unset: typeof ParseOp.UnsetOp;
+ Increment: typeof ParseOp.IncrementOp;
+ Add: typeof ParseOp.AddOp;
+ Remove: typeof ParseOp.RemoveOp;
+ AddUnique: typeof ParseOp.AddUniqueOp;
+ Relation: typeof ParseOp.RelationOp;
+ };
+ Push: typeof Push;
+ Query: typeof Query;
+ Relation: typeof Relation;
+ Role: typeof Role;
+ Schema: typeof Schema;
+ Session: typeof Session;
+ Storage: typeof Storage;
+ User: typeof User;
+ LiveQuery: typeof LiveQuery;
+ LiveQueryClient: typeof LiveQueryClient;
+ initialize(applicationId: string, javaScriptKey: string): void;
+ _initialize(applicationId: string, javaScriptKey: string, masterKey?: string): void;
+ setAsyncStorage(storage: any): void;
+ setLocalDatastoreController(controller: any): void;
+ getServerHealth(): Promise;
+ applicationId: string;
+ javaScriptKey: string;
+ masterKey: string;
+ serverURL: string;
+ serverAuthToken: string;
+ serverAuthType: string;
+ liveQueryServerURL: string;
+ encryptedUser: boolean;
+ secret: string;
+ idempotency: boolean;
+ allowCustomObjectId: boolean;
+ IndexedDB?: any;
+ _request(...args: any[]): void;
+ _ajax(...args: any[]): void;
+ _decode(...args: any[]): void;
+ _encode(...args: any[]): void;
+ _getInstallationId?(): string;
+ enableLocalDatastore(polling: boolean, ms: number): void;
+ isLocalDatastoreEnabled(): boolean;
+ dumpLocalDatastore(): void;
+ enableEncryptedUser(): void;
+ isEncryptedUserEnabled(): void;
+}
+declare const Parse: ParseType;
+export default Parse;
diff --git a/types/ParseACL.d.ts b/types/ParseACL.d.ts
new file mode 100644
index 000000000..3d29cf5ea
--- /dev/null
+++ b/types/ParseACL.d.ts
@@ -0,0 +1,141 @@
+export default ParseACL;
+/**
+ * Creates a new ACL.
+ * If no argument is given, the ACL has no permissions for anyone.
+ * If the argument is a Parse.User, the ACL will have read and write
+ * permission for only that user.
+ * If the argument is any other JSON object, that object will be interpretted
+ * as a serialized ACL created with toJSON().
+ *
+ *
An ACL, or Access Control List can be added to any
+ * Parse.Object to restrict access to only a subset of users
+ * of your application.
+ *
+ * @alias Parse.ACL
+ */
+declare class ParseACL {
+ /**
+ * @param {(Parse.User | object)} arg1 The user to initialize the ACL for
+ */
+ constructor(arg1: ParseUser | ByIdMap);
+ permissionsById: ByIdMap;
+ /**
+ * Returns a JSON-encoded version of the ACL.
+ *
+ * @returns {object}
+ */
+ toJSON(): ByIdMap;
+ /**
+ * Returns whether this ACL is equal to another object
+ *
+ * @param {ParseACL} other The other object's ACL to compare to
+ * @returns {boolean}
+ */
+ equals(other: ParseACL): boolean;
+ _setAccess(accessType: string, userId: ParseUser | ParseRole | string, allowed: boolean): void;
+ _getAccess(accessType: string, userId: ParseUser | ParseRole | string): boolean;
+ /**
+ * Sets whether the given user is allowed to read this object.
+ *
+ * @param userId An instance of Parse.User or its objectId.
+ * @param {boolean} allowed Whether that user should have read access.
+ */
+ setReadAccess(userId: ParseUser | ParseRole | string, allowed: boolean): void;
+ /**
+ * Get whether the given user id is *explicitly* allowed to read this object.
+ * Even if this returns false, the user may still be able to access it if
+ * getPublicReadAccess returns true or a role that the user belongs to has
+ * write access.
+ *
+ * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
+ * @returns {boolean}
+ */
+ getReadAccess(userId: ParseUser | ParseRole | string): boolean;
+ /**
+ * Sets whether the given user id is allowed to write this object.
+ *
+ * @param userId An instance of Parse.User or its objectId, or a Parse.Role..
+ * @param {boolean} allowed Whether that user should have write access.
+ */
+ setWriteAccess(userId: ParseUser | ParseRole | string, allowed: boolean): void;
+ /**
+ * Gets whether the given user id is *explicitly* allowed to write this object.
+ * Even if this returns false, the user may still be able to write it if
+ * getPublicWriteAccess returns true or a role that the user belongs to has
+ * write access.
+ *
+ * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
+ * @returns {boolean}
+ */
+ getWriteAccess(userId: ParseUser | ParseRole | string): boolean;
+ /**
+ * Sets whether the public is allowed to read this object.
+ *
+ * @param {boolean} allowed
+ */
+ setPublicReadAccess(allowed: boolean): void;
+ /**
+ * Gets whether the public is allowed to read this object.
+ *
+ * @returns {boolean}
+ */
+ getPublicReadAccess(): boolean;
+ /**
+ * Sets whether the public is allowed to write this object.
+ *
+ * @param {boolean} allowed
+ */
+ setPublicWriteAccess(allowed: boolean): void;
+ /**
+ * Gets whether the public is allowed to write this object.
+ *
+ * @returns {boolean}
+ */
+ getPublicWriteAccess(): boolean;
+ /**
+ * Gets whether users belonging to the given role are allowed
+ * to read this object. Even if this returns false, the role may
+ * still be able to write it if a parent role has read access.
+ *
+ * @param role The name of the role, or a Parse.Role object.
+ * @returns {boolean} true if the role has read access. false otherwise.
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
+ */
+ getRoleReadAccess(role: ParseRole | string): boolean;
+ /**
+ * Gets whether users belonging to the given role are allowed
+ * to write this object. Even if this returns false, the role may
+ * still be able to write it if a parent role has write access.
+ *
+ * @param role The name of the role, or a Parse.Role object.
+ * @returns {boolean} true if the role has write access. false otherwise.
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
+ */
+ getRoleWriteAccess(role: ParseRole | string): boolean;
+ /**
+ * Sets whether users belonging to the given role are allowed
+ * to read this object.
+ *
+ * @param role The name of the role, or a Parse.Role object.
+ * @param {boolean} allowed Whether the given role can read this object.
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
+ */
+ setRoleReadAccess(role: ParseRole | string, allowed: boolean): void;
+ /**
+ * Sets whether users belonging to the given role are allowed
+ * to write this object.
+ *
+ * @param role The name of the role, or a Parse.Role object.
+ * @param {boolean} allowed Whether the given role can write this object.
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
+ */
+ setRoleWriteAccess(role: ParseRole | string, allowed: boolean): void;
+}
+type ByIdMap = {
+ [userId: string]: PermissionsMap;
+};
+import ParseUser from './ParseUser';
+import ParseRole from './ParseRole';
+type PermissionsMap = {
+ [permission: string]: boolean;
+};
diff --git a/types/ParseCLP.d.ts b/types/ParseCLP.d.ts
new file mode 100644
index 000000000..14b36e7d3
--- /dev/null
+++ b/types/ParseCLP.d.ts
@@ -0,0 +1,290 @@
+type PermissionsMap = {
+ [permission: string]: UsersMap;
+};
+export default ParseCLP;
+type UsersMap = {
+ [userId: string]: any;
+};
+declare const UsersMap: any;
+/**
+ * Creates a new CLP.
+ * If no argument is given, the CLP has no permissions for anyone.
+ * If the argument is a Parse.User or Parse.Role, the CLP will have read and write
+ * permission for only that user or role.
+ * If the argument is any other JSON object, that object will be interpretted
+ * as a serialized CLP created with toJSON().
+ *
+ *
A CLP, or Class Level Permissions can be added to any
+ * Parse.Schema to restrict access to only a subset of users
+ * of your application.
+ *
+ * @alias Parse.CLP
+ */
+declare class ParseCLP {
+ /**
+ * @param {(Parse.User | Parse.Role | object)} userId The user to initialize the CLP for
+ */
+ constructor(userId: ParseUser | ParseRole | PermissionsMap);
+ permissionsMap: PermissionsMap;
+ /**
+ * Returns a JSON-encoded version of the CLP.
+ *
+ * @returns {object}
+ */
+ toJSON(): PermissionsMap;
+ /**
+ * Returns whether this CLP is equal to another object
+ *
+ * @param other The other object to compare to
+ * @returns {boolean}
+ */
+ equals(other: ParseCLP): boolean;
+ _getRoleName(role: ParseRole | string): string;
+ _parseEntity(entity: any): string;
+ _setAccess(permission: string, userId: any, allowed: boolean): void;
+ _getAccess(permission: string, userId: any, returnBoolean?: boolean): boolean | string[];
+ _setArrayAccess(permission: string, userId: any, fields: string): void;
+ _setGroupPointerPermission(operation: string, pointerFields: string[]): void;
+ _getGroupPointerPermissions(operation: string): string[];
+ /**
+ * Sets user pointer fields to allow permission for get/count/find operations.
+ *
+ * @param {string[]} pointerFields User pointer fields
+ */
+ setReadUserFields(pointerFields: string[]): void;
+ /**
+ * @returns {string[]} User pointer fields
+ */
+ getReadUserFields(): string[];
+ /**
+ * Sets user pointer fields to allow permission for create/delete/update/addField operations
+ *
+ * @param {string[]} pointerFields User pointer fields
+ */
+ setWriteUserFields(pointerFields: string[]): void;
+ /**
+ * @returns {string[]} User pointer fields
+ */
+ getWriteUserFields(): string[];
+ /**
+ * Sets whether the given user is allowed to retrieve fields from this class.
+ *
+ * @param userId An instance of Parse.User or its objectId.
+ * @param {string[]} fields fields to be protected
+ */
+ setProtectedFields(userId: any, fields: string[]): void;
+ /**
+ * Returns array of fields are accessable to this user.
+ *
+ * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
+ * @returns {string[]}
+ */
+ getProtectedFields(userId: any): string[];
+ /**
+ * Sets whether the given user is allowed to read from this class.
+ *
+ * @param userId An instance of Parse.User or its objectId.
+ * @param {boolean} allowed whether that user should have read access.
+ */
+ setReadAccess(userId: any, allowed: boolean): void;
+ /**
+ * Get whether the given user id is *explicitly* allowed to read from this class.
+ * Even if this returns false, the user may still be able to access it if
+ * getPublicReadAccess returns true or a role that the user belongs to has
+ * write access.
+ *
+ * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
+ * @returns {boolean}
+ */
+ getReadAccess(userId: any): boolean;
+ /**
+ * Sets whether the given user id is allowed to write to this class.
+ *
+ * @param userId An instance of Parse.User or its objectId, or a Parse.Role..
+ * @param {boolean} allowed Whether that user should have write access.
+ */
+ setWriteAccess(userId: any, allowed: boolean): void;
+ /**
+ * Gets whether the given user id is *explicitly* allowed to write to this class.
+ * Even if this returns false, the user may still be able to write it if
+ * getPublicWriteAccess returns true or a role that the user belongs to has
+ * write access.
+ *
+ * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
+ * @returns {boolean}
+ */
+ getWriteAccess(userId: any): boolean;
+ /**
+ * Sets whether the public is allowed to read from this class.
+ *
+ * @param {boolean} allowed
+ */
+ setPublicReadAccess(allowed: boolean): void;
+ /**
+ * Gets whether the public is allowed to read from this class.
+ *
+ * @returns {boolean}
+ */
+ getPublicReadAccess(): boolean;
+ /**
+ * Sets whether the public is allowed to write to this class.
+ *
+ * @param {boolean} allowed
+ */
+ setPublicWriteAccess(allowed: boolean): void;
+ /**
+ * Gets whether the public is allowed to write to this class.
+ *
+ * @returns {boolean}
+ */
+ getPublicWriteAccess(): boolean;
+ /**
+ * Sets whether the public is allowed to protect fields in this class.
+ *
+ * @param {string[]} fields
+ */
+ setPublicProtectedFields(fields: string[]): void;
+ /**
+ * Gets whether the public is allowed to read fields from this class.
+ *
+ * @returns {string[]}
+ */
+ getPublicProtectedFields(): string[];
+ /**
+ * Gets whether users belonging to the given role are allowed
+ * to read from this class. Even if this returns false, the role may
+ * still be able to write it if a parent role has read access.
+ *
+ * @param role The name of the role, or a Parse.Role object.
+ * @returns {boolean} true if the role has read access. false otherwise.
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
+ */
+ getRoleReadAccess(role: ParseRole | string): boolean;
+ /**
+ * Gets whether users belonging to the given role are allowed
+ * to write to this user. Even if this returns false, the role may
+ * still be able to write it if a parent role has write access.
+ *
+ * @param role The name of the role, or a Parse.Role object.
+ * @returns {boolean} true if the role has write access. false otherwise.
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
+ */
+ getRoleWriteAccess(role: ParseRole | string): boolean;
+ /**
+ * Sets whether users belonging to the given role are allowed
+ * to read from this class.
+ *
+ * @param role The name of the role, or a Parse.Role object.
+ * @param {boolean} allowed Whether the given role can read this object.
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
+ */
+ setRoleReadAccess(role: ParseRole | string, allowed: boolean): void;
+ /**
+ * Sets whether users belonging to the given role are allowed
+ * to write to this class.
+ *
+ * @param role The name of the role, or a Parse.Role object.
+ * @param {boolean} allowed Whether the given role can write this object.
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
+ */
+ setRoleWriteAccess(role: ParseRole | string, allowed: boolean): void;
+ /**
+ * Gets whether users belonging to the given role are allowed
+ * to count to this user. Even if this returns false, the role may
+ * still be able to count it if a parent role has count access.
+ *
+ * @param role The name of the role, or a Parse.Role object.
+ * @returns {string[]}
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
+ */
+ getRoleProtectedFields(role: ParseRole | string): string[];
+ /**
+ * Sets whether users belonging to the given role are allowed
+ * to set access field in this class.
+ *
+ * @param role The name of the role, or a Parse.Role object.
+ * @param {string[]} fields Fields to be protected by Role.
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
+ */
+ setRoleProtectedFields(role: ParseRole | string, fields: string[]): void;
+}
+import ParseRole from './ParseRole';
+import ParseUser from './ParseUser';
diff --git a/types/ParseConfig.d.ts b/types/ParseConfig.d.ts
new file mode 100644
index 000000000..c51436666
--- /dev/null
+++ b/types/ParseConfig.d.ts
@@ -0,0 +1,76 @@
+export default ParseConfig;
+/**
+ * Parse.Config is a local representation of configuration data that
+ * can be set from the Parse dashboard.
+ *
+ * @alias Parse.Config
+ */
+declare class ParseConfig {
+ /**
+ * Retrieves the most recently-fetched configuration object, either from
+ * memory or from local storage if necessary.
+ *
+ * @static
+ * @returns {Parse.Config} The most recently-fetched Parse.Config if it
+ * exists, else an empty Parse.Config.
+ */
+ static current(): Parse.Config;
+ /**
+ * Gets a new configuration object from the server.
+ *
+ * @static
+ * @param {object} options
+ * Valid options are:
+ *
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
+ * configuration object when the get completes.
+ */
+ static get(options?: RequestOptions): Promise;
+ /**
+ * Save value keys to the server.
+ *
+ * @static
+ * @param {object} attrs The config parameters and values.
+ * @param {object} masterKeyOnlyFlags The flags that define whether config parameters listed
+ * in `attrs` should be retrievable only by using the master key.
+ * 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
+ * configuration object or with the current with the update.
+ */
+ static save(attrs: {
+ [key: string]: any;
+ }, masterKeyOnlyFlags: {
+ [key: string]: any;
+ }): Promise;
+ /**
+ * Used for testing
+ *
+ * @private
+ */
+ private static _clearCache;
+ attributes: {
+ [key: string]: any;
+ };
+ _escapedAttributes: {
+ [key: string]: any;
+ };
+ /**
+ * Gets the value of an attribute.
+ *
+ * @param {string} attr The name of an attribute.
+ * @returns {*}
+ */
+ get(attr: string): any;
+ /**
+ * Gets the HTML-escaped value of an attribute.
+ *
+ * @param {string} attr The name of an attribute.
+ * @returns {string}
+ */
+ escape(attr: string): string;
+}
+import { RequestOptions } from './RESTController';
diff --git a/types/ParseError.d.ts b/types/ParseError.d.ts
new file mode 100644
index 000000000..a276ae251
--- /dev/null
+++ b/types/ParseError.d.ts
@@ -0,0 +1,77 @@
+export default ParseError;
+/**
+ * Constructs a new Parse.Error object with the given code and message.
+ *
+ * @alias Parse.Error
+ */
+declare class ParseError extends Error {
+ /**
+ * @param {number} code An error code constant from Parse.Error.
+ * @param {string} message A detailed description of the error.
+ */
+ constructor(code: number, message: string);
+ code: number;
+}
+declare namespace ParseError {
+ let OTHER_CAUSE: number;
+ let INTERNAL_SERVER_ERROR: number;
+ let CONNECTION_FAILED: number;
+ let OBJECT_NOT_FOUND: number;
+ let INVALID_QUERY: number;
+ let INVALID_CLASS_NAME: number;
+ let MISSING_OBJECT_ID: number;
+ let INVALID_KEY_NAME: number;
+ let INVALID_POINTER: number;
+ let INVALID_JSON: number;
+ let COMMAND_UNAVAILABLE: number;
+ let NOT_INITIALIZED: number;
+ let INCORRECT_TYPE: number;
+ let INVALID_CHANNEL_NAME: number;
+ let PUSH_MISCONFIGURED: number;
+ let OBJECT_TOO_LARGE: number;
+ let OPERATION_FORBIDDEN: number;
+ let CACHE_MISS: number;
+ let INVALID_NESTED_KEY: number;
+ let INVALID_FILE_NAME: number;
+ let INVALID_ACL: number;
+ let TIMEOUT: number;
+ let INVALID_EMAIL_ADDRESS: number;
+ let MISSING_CONTENT_TYPE: number;
+ let MISSING_CONTENT_LENGTH: number;
+ let INVALID_CONTENT_LENGTH: number;
+ let FILE_TOO_LARGE: number;
+ let FILE_SAVE_ERROR: number;
+ let DUPLICATE_VALUE: number;
+ let INVALID_ROLE_NAME: number;
+ let EXCEEDED_QUOTA: number;
+ let SCRIPT_FAILED: number;
+ let VALIDATION_ERROR: number;
+ let INVALID_IMAGE_DATA: number;
+ let UNSAVED_FILE_ERROR: number;
+ let INVALID_PUSH_TIME_ERROR: number;
+ let FILE_DELETE_ERROR: number;
+ let FILE_DELETE_UNNAMED_ERROR: number;
+ let REQUEST_LIMIT_EXCEEDED: number;
+ let DUPLICATE_REQUEST: number;
+ let INVALID_EVENT_NAME: number;
+ let INVALID_VALUE: number;
+ let USERNAME_MISSING: number;
+ let PASSWORD_MISSING: number;
+ let USERNAME_TAKEN: number;
+ let EMAIL_TAKEN: number;
+ let EMAIL_MISSING: number;
+ let EMAIL_NOT_FOUND: number;
+ let SESSION_MISSING: number;
+ let MUST_CREATE_USER_THROUGH_SIGNUP: number;
+ let ACCOUNT_ALREADY_LINKED: number;
+ let INVALID_SESSION_TOKEN: number;
+ let MFA_ERROR: number;
+ let MFA_TOKEN_REQUIRED: number;
+ let LINKED_ID_MISSING: number;
+ let INVALID_LINKED_SESSION: number;
+ let UNSUPPORTED_SERVICE: number;
+ let INVALID_SCHEMA_OPERATION: number;
+ let AGGREGATE_ERROR: number;
+ let FILE_READ_ERROR: number;
+ let X_DOMAIN_REQUEST: number;
+}
diff --git a/types/ParseFile.d.ts b/types/ParseFile.d.ts
new file mode 100644
index 000000000..78d5becbd
--- /dev/null
+++ b/types/ParseFile.d.ts
@@ -0,0 +1,180 @@
+type FileSource = {
+ format: "file";
+ file: Blob;
+ type: string;
+} | {
+ format: "base64";
+ base64: string;
+ type: string;
+} | {
+ format: "uri";
+ uri: string;
+ type: string;
+};
+export default ParseFile;
+/**
+ * A Parse.File is a local representation of a file that is saved to the Parse
+ * cloud.
+ *
+ * @alias Parse.File
+ */
+declare class ParseFile {
+ static fromJSON(obj: any): ParseFile;
+ static encodeBase64(bytes: Array): string;
+ /**
+ * @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:
+ * 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.
+ * 4. a File object selected with a file upload control. (3) only works
+ * in Firefox 3.6+, Safari 6.0.2+, Chrome 7+, and IE 10+.
+ * For example:
+ *
+ * var fileUploadControl = $("#profilePhotoFileUpload")[0];
+ * if (fileUploadControl.files.length > 0) {
+ * var file = fileUploadControl.files[0];
+ * var name = "photo.jpg";
+ * var parseFile = new Parse.File(name, file);
+ * parseFile.save().then(function() {
+ * // The file has been saved to Parse.
+ * }, function(error) {
+ * // 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
+ * 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
+ */
+ constructor(name: string, data?: FileData, type?: string, metadata?: Object, tags?: Object);
+ _name: string;
+ _url: string | null;
+ _source: FileSource;
+ _previousSave: Promise | null;
+ _data: string | null;
+ _requestTask: any | null;
+ _metadata: Object | null;
+ _tags: Object | null;
+ /**
+ * Return the data for the file, downloading it if not already present.
+ * 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
+ */
+ getData(): Promise;
+ /**
+ * Gets the name of the file. Before save is called, this is the filename
+ * given by the user. After save is called, that name gets prefixed with a
+ * unique identifier.
+ *
+ * @returns {string}
+ */
+ name(): string;
+ /**
+ * 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
+ * @returns {string | undefined}
+ */
+ url(options?: {
+ forceSecure?: boolean;
+ }): string | null;
+ /**
+ * Gets the metadata of the file.
+ *
+ * @returns {object}
+ */
+ metadata(): Object;
+ /**
+ * Gets the tags of the file.
+ *
+ * @returns {object}
+ */
+ tags(): Object;
+ /**
+ * Saves the file to the Parse cloud.
+ *
+ * @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.
+ *
progress: In Browser only, callback for upload progress. For example:
+ *
+ * let parseFile = new Parse.File(name, file);
+ * parseFile.save({
+ * progress: (progressValue, loaded, total, { type }) => {
+ * if (type === "upload" && progressValue !== null) {
+ * // Update the UI using progressValue
+ * }
+ * }
+ * });
+ *
+ *
+ * @returns {Promise | undefined} Promise that is resolved when the save finishes.
+ */
+ save(options?: FullOptions): Promise | null;
+ /**
+ * Aborts the request if it has already been sent.
+ */
+ cancel(): void;
+ /**
+ * Deletes the file from the Parse cloud.
+ * In Cloud Code and Node only with Master Key.
+ *
+ * @param {object} 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.
+ */
+ destroy(options?: FullOptions): Promise;
+ toJSON(): {
+ name: string | null;
+ url: string | null;
+ };
+ equals(other: mixed): boolean;
+ /**
+ * Sets metadata to be saved with file object. Overwrites existing metadata
+ *
+ * @param {object} metadata Key value pairs to be stored with file object
+ */
+ setMetadata(metadata: any): void;
+ /**
+ * Sets metadata to be saved with file object. Adds to existing metadata.
+ *
+ * @param {string} key key to store the metadata
+ * @param {*} value metadata
+ */
+ addMetadata(key: string, value: any): void;
+ /**
+ * Sets tags to be saved with file object. Overwrites existing tags
+ *
+ * @param {object} tags Key value pairs to be stored with file object
+ */
+ setTags(tags: any): void;
+ /**
+ * Sets tags to be saved with file object. Adds to existing tags.
+ *
+ * @param {string} key key to store tags
+ * @param {*} value tag
+ */
+ addTag(key: string, value: string): void;
+}
+import { FullOptions } from './RESTController';
+type FileData = number[] | Blob | Base64 | Uri;
+type Base64 = {
+ base64: string;
+};
+type Uri = {
+ uri: string;
+};
diff --git a/types/ParseGeoPoint.d.ts b/types/ParseGeoPoint.d.ts
new file mode 100644
index 000000000..4d6c4efd0
--- /dev/null
+++ b/types/ParseGeoPoint.d.ts
@@ -0,0 +1,97 @@
+export default ParseGeoPoint;
+/**
+ * @flow
+ */
+/**
+ * Creates a new GeoPoint with any of the following forms:
+ *
+ * new GeoPoint(otherGeoPoint)
+ * new GeoPoint(30, 30)
+ * new GeoPoint([30, 30])
+ * new GeoPoint({latitude: 30, longitude: 30})
+ * new GeoPoint() // defaults to (0, 0)
+ *
+ *
Represents a latitude / longitude point that may be associated
+ * with a key in a ParseObject or used as a reference point for geo queries.
+ * This allows proximity-based queries on the key.
+ *
+ *
Only one key in a class may contain a GeoPoint.
+ *
+ *
Example:
+ * var point = new Parse.GeoPoint(30.0, -20.0);
+ * var object = new Parse.Object("PlaceObject");
+ * object.set("location", point);
+ * object.save();
+ *
+ * @alias Parse.GeoPoint
+ */
+declare class ParseGeoPoint {
+ static _validate(latitude: number, longitude: number): void;
+ /**
+ * Creates a GeoPoint with the user's current location, if available.
+ *
+ * @static
+ * @returns {Parse.GeoPoint} User's current location
+ */
+ static current(): 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, arg2?: number);
+ _latitude: number;
+ _longitude: number;
+ set latitude(arg: number);
+ /**
+ * North-south portion of the coordinate, in range [-90, 90].
+ * Throws an exception if set out of range in a modern browser.
+ *
+ * @property {number} latitude
+ * @returns {number}
+ */
+ get latitude(): number;
+ set longitude(arg: number);
+ /**
+ * East-west portion of the coordinate, in range [-180, 180].
+ * Throws if set out of range in a modern browser.
+ *
+ * @property {number} longitude
+ * @returns {number}
+ */
+ get longitude(): number;
+ /**
+ * Returns a JSON representation of the GeoPoint, suitable for Parse.
+ *
+ * @returns {object}
+ */
+ toJSON(): {
+ __type: string;
+ latitude: number;
+ longitude: number;
+ };
+ equals(other: mixed): boolean;
+ /**
+ * Returns the distance from this GeoPoint to another in radians.
+ *
+ * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
+ * @returns {number}
+ */
+ radiansTo(point: ParseGeoPoint): number;
+ /**
+ * Returns the distance from this GeoPoint to another in kilometers.
+ *
+ * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
+ * @returns {number}
+ */
+ kilometersTo(point: ParseGeoPoint): number;
+ /**
+ * Returns the distance from this GeoPoint to another in miles.
+ *
+ * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
+ * @returns {number}
+ */
+ milesTo(point: ParseGeoPoint): number;
+}
diff --git a/types/ParseInstallation.d.ts b/types/ParseInstallation.d.ts
new file mode 100644
index 000000000..b0c07e2df
--- /dev/null
+++ b/types/ParseInstallation.d.ts
@@ -0,0 +1,5 @@
+export default class Installation extends ParseObject {
+ constructor(attributes: AttributeMap | null);
+}
+import ParseObject from './ParseObject';
+import { AttributeMap } from './ObjectStateMutations';
diff --git a/types/ParseLiveQuery.d.ts b/types/ParseLiveQuery.d.ts
new file mode 100644
index 000000000..6e98e68c1
--- /dev/null
+++ b/types/ParseLiveQuery.d.ts
@@ -0,0 +1,29 @@
+export default LiveQuery;
+/**
+ * We expose three events to help you monitor the status of the WebSocket connection:
+ *
+ *
Open - When we establish the WebSocket connection to the LiveQuery server, you'll get this event.
+ *
+ *
You won't normally call this method directly. It is recommended that
+ * you use a subclass of Parse.Object instead, created by calling
+ * extend.
+ *
+ *
However, if you don't want to use a subclass, or aren't sure which
+ * subclass is appropriate, you can use this form:
+ * var object = new Parse.Object("ClassName");
+ *
+ * That is basically equivalent to:
+ * var MyClass = Parse.Object.extend("ClassName");
+ * var object = new MyClass();
+ *
+ *
+ * @alias Parse.Object
+ */
+declare class ParseObject {
+ static _getClassMap(): {};
+ static _clearAllState(): void;
+ /**
+ * Fetches the given list of Parse.Object.
+ * If any error is encountered, stops and calls the error handler.
+ *
+ *
+ * Parse.Object.fetchAll([object1, object2, ...])
+ * .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 {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.
+ *
include: The name(s) of the key(s) to include. Can be a string, an array of strings,
+ * or an array of array of strings.
+ *
+ * @static
+ * @returns {Parse.Object[]}
+ */
+ static fetchAll(list: Array, options?: RequestOptions): Parse.Object[];
+ /**
+ * Fetches the given list of Parse.Object.
+ *
+ * Includes nested Parse.Objects for the provided key. You can use dot
+ * notation to specify which fields in the included object are also fetched.
+ *
+ * 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.
+ * });
+ *
+ *
+ * @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.
+ *
+ * @static
+ * @returns {Parse.Object[]}
+ */
+ static fetchAllWithInclude(list: Array, keys: String | Array>, options: RequestOptions): Parse.Object[];
+ /**
+ * Fetches the given list of Parse.Object if needed.
+ * If any error is encountered, stops and calls the error handler.
+ *
+ * Includes nested Parse.Objects for the provided key. You can use dot
+ * notation to specify which fields in the included object are also fetched.
+ *
+ * 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.
+ * });
+ *
+ *
+ * @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.
+ *
+ * @static
+ * @returns {Parse.Object[]}
+ */
+ static fetchAllIfNeededWithInclude(list: Array, keys: String | Array>, options: RequestOptions): Parse.Object[];
+ /**
+ * Fetches the given list of Parse.Object if needed.
+ * If any error is encountered, stops and calls the error handler.
+ *
+ *
+ * Parse.Object.fetchAllIfNeeded([object1, ...])
+ * .then((list) => {
+ * // Objects were fetched and updated.
+ * }, (error) => {
+ * // An error occurred while fetching one of the objects.
+ * });
+ *
+ *
+ * @param {Array} list A list of Parse.Object.
+ * @param {object} options
+ * @static
+ * @returns {Parse.Object[]}
+ */
+ static fetchAllIfNeeded(list: Array, options: object): Parse.Object[];
+ static handleIncludeOptions(options: any): any[];
+ /**
+ * Destroy the given list of models on the server if it was already persisted.
+ *
+ *
Unlike saveAll, if an error occurs while deleting an individual model,
+ * this method will continue trying to delete the rest of the models if
+ * possible, except in the case of a fatal error like a connection error.
+ *
+ *
In particular, the Parse.Error object returned in the case of error may
+ * be one of two types:
+ *
+ *
+ *
A Parse.Error.AGGREGATE_ERROR. This object's "errors" property is an
+ * array of other Parse.Error objects. Each error object in this array
+ * has an "object" property that references the object that could not be
+ * deleted (for instance, because that object could not be found).
+ *
A non-aggregate Parse.Error. This indicates a serious error that
+ * caused the delete operation to be aborted partway through (for
+ * instance, a connection failure in the middle of the delete).
+ *
+ *
+ *
+ * Parse.Object.destroyAll([object1, object2, ...])
+ * .then((list) => {
+ * // All the objects were deleted.
+ * }, (error) => {
+ * // An error occurred while deleting one or more of the objects.
+ * // If this is an aggregate error, then we can inspect each error
+ * // object individually to determine the reason why a particular
+ * // object was not deleted.
+ * if (error.code === Parse.Error.AGGREGATE_ERROR) {
+ * for (var i = 0; i < error.errors.length; i++) {
+ * console.log("Couldn't delete " + error.errors[i].object.id +
+ * "due to " + error.errors[i].message);
+ * }
+ * } else {
+ * console.log("Delete aborted because of " + error.message);
+ * }
+ * });
+ *
+ *
+ * @param {Array} list A list of Parse.Object.
+ * @param {object} options
+ * @static
+ * @returns {Promise} A promise that is fulfilled when the destroyAll
+ * completes.
+ */
+ static destroyAll(list: Array, options?: object): Promise;
+ /**
+ * Saves the given list of Parse.Object.
+ * If any error is encountered, stops and calls the error handler.
+ *
+ *
+ * Parse.Object.saveAll([object1, object2, ...])
+ * .then((list) => {
+ * // All the objects were saved.
+ * }, (error) => {
+ * // An error occurred while saving one of the objects.
+ * });
+ *
+ *
+ * @param {Array} list A list of Parse.Object.
+ * @param {object} options
+ * @static
+ * @returns {Parse.Object[]}
+ */
+ static saveAll(list: Array, options?: RequestOptions): Parse.Object[];
+ /**
+ * Creates a reference to a subclass of Parse.Object with the given id. This
+ * does not exist on Parse.Object, only on subclasses.
+ *
+ *
A shortcut for:
+ * var Foo = Parse.Object.extend("Foo");
+ * var pointerToFoo = new Foo();
+ * pointerToFoo.id = "myObjectId";
+ *
+ *
+ * @param {string} id The ID of the object to create a reference to.
+ * @static
+ * @returns {Parse.Object} A Parse.Object reference.
+ */
+ static createWithoutData(id: string): Parse.Object;
+ /**
+ * 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
+ * is overwritten if this is set to true
+ * @param {boolean} dirty Whether the Parse.Object should set JSON keys to dirty
+ * @static
+ * @returns {Parse.Object} A Parse.Object reference
+ */
+ static fromJSON(json: any, override?: boolean, dirty?: boolean): Parse.Object;
+ /**
+ * Registers a subclass of Parse.Object with a specific class name.
+ * When objects of that class are retrieved from a query, they will be
+ * instantiated with this subclass.
+ * This is only necessary when using ES6 subclassing.
+ *
+ * @param {string} className The class name of the subclass
+ * @param {Function} constructor The subclass
+ */
+ static registerSubclass(className: string, constructor: any): void;
+ /**
+ * Unegisters a subclass of Parse.Object with a specific class name.
+ *
+ * @param {string} className The class name of the subclass
+ */
+ static unregisterSubclass(className: string): void;
+ /**
+ * Creates a new subclass of Parse.Object for the given Parse class name.
+ *
+ *
Every extension of a Parse class will inherit from the most recent
+ * previous extension of that class. When a Parse.Object is automatically
+ * created by parsing JSON, it will use the most recent extension of that
+ * class.
+ *
+ * @param {string} className The name of the Parse class backing this model.
+ * @param {object} protoProps Instance properties to add to instances of the
+ * class returned from this method.
+ * @param {object} classProps Class properties to add the class returned from
+ * this method.
+ * @returns {Parse.Object} A new subclass of Parse.Object.
+ */
+ static extend(className: any, protoProps: any, classProps: any): Parse.Object;
+ /**
+ * Enable single instance objects, where any local objects with the same Id
+ * share the same attributes, and stay synchronized with each other.
+ * This is disabled by default in server environments, since it can lead to
+ * security issues.
+ *
+ * @static
+ */
+ static enableSingleInstance(): void;
+ /**
+ * Disable single instance objects, where any local objects with the same Id
+ * share the same attributes, and stay synchronized with each other.
+ * When disabled, you can have two instances of the same object in memory
+ * without them sharing attributes.
+ *
+ * @static
+ */
+ static disableSingleInstance(): void;
+ /**
+ * Asynchronously stores the objects and every object they point to in the local datastore,
+ * recursively, using a default pin name: _default.
+ *
+ * If those other objects have not been fetched from Parse, they will not be stored.
+ * However, if they have changed data, all the changes will be retained.
+ *
+ *
+ * await Parse.Object.pinAll([...]);
+ *
+ *
+ * To retrieve object:
+ * query.fromLocalDatastore() or query.fromPin()
+ *
+ * @param {Array} objects A list of Parse.Object.
+ * @returns {Promise} A promise that is fulfilled when the pin completes.
+ * @static
+ */
+ static pinAll(objects: Array): Promise;
+ /**
+ * Asynchronously stores the objects and every object they point to in the local datastore, recursively.
+ *
+ * If those other objects have not been fetched from Parse, they will not be stored.
+ * However, if they have changed data, all the changes will be retained.
+ *
+ *
+ *
+ * To retrieve object:
+ * query.fromLocalDatastore() or query.fromPinWithName(name)
+ *
+ * @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.
+ * @static
+ */
+ static pinAllWithName(name: string, objects: Array): Promise;
+ /**
+ * Asynchronously removes the objects and every object they point to in the local datastore,
+ * recursively, using a default pin name: _default.
+ *
+ *
+ * await Parse.Object.unPinAll([...]);
+ *
+ *
+ * @param {Array} objects A list of Parse.Object.
+ * @returns {Promise} A promise that is fulfilled when the unPin completes.
+ * @static
+ */
+ static unPinAll(objects: Array): Promise;
+ /**
+ * Asynchronously removes the objects and every object they point to in the local datastore, recursively.
+ *
+ *
+ *
+ * @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.
+ * @static
+ */
+ static unPinAllWithName(name: string, objects: Array): Promise;
+ /**
+ * Asynchronously removes all objects in the local datastore using a default pin name: _default.
+ *
+ *
+ * await Parse.Object.unPinAllObjects();
+ *
+ *
+ * @returns {Promise} A promise that is fulfilled when the unPin completes.
+ * @static
+ */
+ static unPinAllObjects(): Promise;
+ /**
+ * Asynchronously removes all objects with the specified pin name.
+ * Deletes the pin name also.
+ *
+ *
+ *
+ * @param {string} name Name of Pin.
+ * @returns {Promise} A promise that is fulfilled when the unPin completes.
+ * @static
+ */
+ static unPinAllObjectsWithName(name: string): Promise;
+ /**
+ * @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.
+ */
+ constructor(className: string | {
+ [attr: string]: mixed;
+ className: string;
+ }, attributes?: {
+ [attr: string]: mixed;
+ }, options?: {
+ ignoreValidation: boolean;
+ }, ...args: any[]);
+ _objCount: number;
+ className: string;
+ /**
+ * The ID of this object, unique within its class.
+ *
+ * @property {string} id
+ */
+ id: string | null;
+ _localId: string | null;
+ get attributes(): AttributeMap;
+ /**
+ * The first time this object was saved on the server.
+ *
+ * @property {Date} createdAt
+ * @returns {Date}
+ */
+ get createdAt(): Date;
+ /**
+ * The last time this object was updated on the server.
+ *
+ * @property {Date} updatedAt
+ * @returns {Date}
+ */
+ get updatedAt(): Date;
+ /**
+ * Returns a local or server Id used uniquely identify this object
+ *
+ * @returns {string}
+ */
+ _getId(): string;
+ /**
+ * Returns a unique identifier used to pull data from the State Controller.
+ *
+ * @returns {Parse.Object|object}
+ */
+ _getStateIdentifier(): ParseObject | {
+ id: string;
+ className: string;
+ };
+ _getServerData(): AttributeMap;
+ _clearServerData(): void;
+ _getPendingOps(): Array;
+ /**
+ * @param {Array} [keysToClear] - if specified, only ops matching
+ * these fields will be cleared
+ */
+ _clearPendingOps(keysToClear?: Array): void;
+ _getDirtyObjectAttributes(): AttributeMap;
+ _toFullJSON(seen?: Array, offline?: boolean): AttributeMap;
+ _getSaveJSON(): AttributeMap;
+ _getSaveParams(): SaveParams;
+ _finishFetch(serverData: AttributeMap): void;
+ _setExisted(existed: boolean): void;
+ _migrateId(serverId: string): void;
+ _handleSaveResponse(response: AttributeMap, status: number): void;
+ _handleSaveError(): void;
+ initialize(): void;
+ /**
+ * Returns a JSON version of the object suitable for saving to Parse.
+ *
+ * @param seen
+ * @param offline
+ * @returns {object}
+ */
+ toJSON(seen: Array | void, offline?: boolean): AttributeMap;
+ /**
+ * Determines whether this ParseObject is equal to another ParseObject
+ *
+ * @param {object} other - An other object ot compare
+ * @returns {boolean}
+ */
+ equals(other: mixed): boolean;
+ /**
+ * Returns true if this object has been modified since its last
+ * 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).
+ * @returns {boolean}
+ */
+ dirty(attr?: string): boolean;
+ /**
+ * Returns an array of keys that have been modified since last save/refresh
+ *
+ * @returns {string[]}
+ */
+ dirtyKeys(): Array;
+ /**
+ * Returns true if the object has been fetched.
+ *
+ * @returns {boolean}
+ */
+ isDataAvailable(): boolean;
+ /**
+ * Gets a Pointer referencing this Object.
+ *
+ * @returns {Pointer}
+ */
+ toPointer(): Pointer;
+ /**
+ * Gets a Pointer referencing this Object.
+ *
+ * @returns {Pointer}
+ */
+ toOfflinePointer(): Pointer;
+ /**
+ * Gets the value of an attribute.
+ *
+ * @param {string} attr The string name of an attribute.
+ * @returns {*}
+ */
+ get(attr: string): mixed;
+ /**
+ * Gets a relation on the given class for the attribute.
+ *
+ * @param {string} attr The attribute to get the relation for.
+ * @returns {Parse.Relation}
+ */
+ relation(attr: string): ParseRelation;
+ /**
+ * Gets the HTML-escaped value of an attribute.
+ *
+ * @param {string} attr The string name of an attribute.
+ * @returns {string}
+ */
+ escape(attr: string): string;
+ /**
+ * Returns true if the attribute contains a value that is not
+ * null or undefined.
+ *
+ * @param {string} attr The string name of the attribute.
+ * @returns {boolean}
+ */
+ has(attr: string): boolean;
+ /**
+ * Sets a hash of model attributes on the object.
+ *
+ *
You can call it with an object containing keys and values, with one
+ * key and value, or dot notation. For example:
+ *
+ * @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.
+ * The only supported option is error.
+ * @returns {(ParseObject|boolean)} true if the set succeeded.
+ */
+ set(key: mixed, value: mixed, options?: mixed): ParseObject | boolean;
+ /**
+ * Remove an attribute from the model. This is a noop if the attribute doesn't
+ * exist.
+ *
+ * @param {string} attr The string name of an attribute.
+ * @param options
+ * @returns {(ParseObject | boolean)}
+ */
+ unset(attr: string, options?: {
+ [opt: string]: mixed;
+ }): ParseObject | boolean;
+ /**
+ * 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)}
+ */
+ increment(attr: string, amount?: number): ParseObject | boolean;
+ /**
+ * Atomically decrements 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 decrement by (optional).
+ * @returns {(ParseObject | boolean)}
+ */
+ decrement(attr: string, amount?: number): ParseObject | boolean;
+ /**
+ * Atomically add an object to the end of the array associated with a given
+ * key.
+ *
+ * @param attr {String} The key.
+ * @param item {} The item to add.
+ * @returns {(ParseObject | boolean)}
+ */
+ add(attr: string, item: mixed): ParseObject | boolean;
+ /**
+ * Atomically add the objects to the end of the array associated with a given
+ * key.
+ *
+ * @param attr {String} The key.
+ * @param items {Object[]} The items to add.
+ * @returns {(ParseObject | boolean)}
+ */
+ addAll(attr: string, items: Array): ParseObject | boolean;
+ /**
+ * Atomically add an object to the array associated with a given key, only
+ * if it is not already present in the array. The position of the insert is
+ * not guaranteed.
+ *
+ * @param attr {String} The key.
+ * @param item {} The object to add.
+ * @returns {(ParseObject | boolean)}
+ */
+ addUnique(attr: string, item: mixed): ParseObject | boolean;
+ /**
+ * Atomically add the objects to the array associated with a given key, only
+ * if it is not already present in the array. The position of the insert is
+ * not guaranteed.
+ *
+ * @param attr {String} The key.
+ * @param items {Object[]} The objects to add.
+ * @returns {(ParseObject | boolean)}
+ */
+ addAllUnique(attr: string, items: Array): ParseObject | boolean;
+ /**
+ * Atomically remove all instances of an object from the array associated
+ * with a given key.
+ *
+ * @param attr {String} The key.
+ * @param item {} The object to remove.
+ * @returns {(ParseObject | boolean)}
+ */
+ remove(attr: string, item: mixed): ParseObject | boolean;
+ /**
+ * Atomically remove all instances of the objects from the array associated
+ * with a given key.
+ *
+ * @param attr {String} The key.
+ * @param items {Object[]} The object to remove.
+ * @returns {(ParseObject | boolean)}
+ */
+ removeAll(attr: string, items: Array): ParseObject | boolean;
+ /**
+ * Returns an instance of a subclass of Parse.Op describing what kind of
+ * modification has been performed on this field since the last time it was
+ * saved. For example, after calling object.increment("x"), calling
+ * object.op("x") would return an instance of Parse.Op.Increment.
+ *
+ * @param attr {String} The key.
+ * @returns {Parse.Op | undefined} The operation, or undefined if none.
+ */
+ op(attr: string): Op | null;
+ /**
+ * Creates a new model with identical attributes to this one.
+ *
+ * @returns {Parse.Object}
+ */
+ clone(): any;
+ /**
+ * Creates a new instance of this object. Not to be confused with clone()
+ *
+ * @returns {Parse.Object}
+ */
+ newInstance(): any;
+ /**
+ * Returns true if this object has never been saved to Parse.
+ *
+ * @returns {boolean}
+ */
+ isNew(): boolean;
+ /**
+ * Returns true if this object was created by the Parse server when the
+ * object might have already been there (e.g. in the case of a Facebook
+ * login)
+ *
+ * @returns {boolean}
+ */
+ existed(): boolean;
+ /**
+ * Returns true if this object exists on the Server
+ *
+ * @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 boolean promise that is fulfilled if object exists.
+ */
+ exists(options?: RequestOptions): Promise;
+ /**
+ * Checks if the model is currently in a valid state.
+ *
+ * @returns {boolean}
+ */
+ isValid(): boolean;
+ /**
+ * You should not call this function directly unless you subclass
+ * Parse.Object, in which case you can override this method
+ * to provide additional validation on set and
+ * save. Your implementation should return
+ *
+ * @param {object} attrs The current data to validate.
+ * @returns {Parse.Error|boolean} False if the data is valid. An error object otherwise.
+ * @see Parse.Object#set
+ */
+ validate(attrs: AttributeMap): ParseError | boolean;
+ /**
+ * Returns the ACL for this object.
+ *
+ * @returns {Parse.ACL} An instance of Parse.ACL.
+ * @see Parse.Object#get
+ */
+ getACL(): ParseACL | null;
+ /**
+ * 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.
+ * @see Parse.Object#set
+ */
+ setACL(acl: ParseACL, options?: mixed): ParseObject | boolean;
+ /**
+ * Clears any (or specific) changes to this object made since the last call to save()
+ *
+ * @param {string} [keys] - specify which fields to revert
+ */
+ revert(...keys?: Array): void;
+ /**
+ * Clears all attributes on a model
+ *
+ * @returns {(ParseObject | boolean)}
+ */
+ clear(): ParseObject | boolean;
+ /**
+ * 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
+ * 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.
+ *
include: The name(s) of the key(s) to include. Can be a string, an array of strings,
+ * 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
+ * completes.
+ */
+ fetch(options: RequestOptions): Promise;
+ /**
+ * Fetch the model from the server. If the server's representation of the
+ * model differs from its current attributes, they will be overriden.
+ *
+ * Includes nested Parse.Objects for the provided key. You can use dot
+ * 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
+ * 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
+ * completes.
+ */
+ fetchWithInclude(keys: String | Array>, options: RequestOptions): Promise;
+ /**
+ * Saves this object to the server at some unspecified time in the future,
+ * even if Parse is currently inaccessible.
+ *
+ * Use this when you may not have a solid network connection, and don't need to know when the save completes.
+ * If there is some problem with the object such that it can't be saved, it will be silently discarded.
+ *
+ * Objects saved with this method will be stored locally in an on-disk cache until they can be delivered to Parse.
+ * They will be sent immediately if possible. Otherwise, they will be sent the next time a network connection is
+ * 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]
+ * Used to pass option parameters to method if arg1 and arg2 were both passed as strings.
+ * Valid options are:
+ *
+ *
sessionToken: A valid session token, used for making a request on
+ * behalf of a specific user.
+ *
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
+ * completes.
+ */
+ saveEventually(options?: SaveOptions): Promise;
+ /**
+ * Set a hash of model attributes, and save the model to the server.
+ * updatedAt will be updated when the request returns.
+ * You can either call it as:
+ * object.save();
+ * or
+ * object.save(attrs);
+ * or
+ * object.save(null, options);
+ * or
+ * object.save(attrs, options);
+ * or
+ * object.save(key, value);
+ * or
+ * object.save(key, value, options);
+ *
+ * Example 1:
+ * gameTurn.save({
+ * player: "Jake Cutter",
+ * diceRoll: 2
+ * }).then(function(gameTurnAgain) {
+ * // The save was successful.
+ * }, function(error) {
+ * // The save failed. Error is an instance of Parse.Error.
+ * });
`Object` - Key/value pairs to update on the object.
+ *
`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 {string | object} [arg2]
+ *
+ *
`String` Value - If arg1 was passed as a key, arg2 is the value that should be set on that key.
+ *
`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.
+ *
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.
+ *
+ *
+ *
+ * @param {object} [arg3]
+ * Used to pass option parameters to method if arg1 and arg2 were both passed as strings.
+ * 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.
+ *
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
+ * completes.
+ */
+ save(arg1?: string | {
+ [attr: string]: mixed;
+ }, arg2?: SaveOptions | mixed, arg3?: SaveOptions): Promise;
+ /**
+ * Deletes this object from the server at some unspecified time in the future,
+ * even if Parse is currently inaccessible.
+ *
+ * Use this when you may not have a solid network connection,
+ * and don't need to know when the delete completes. If there is some problem with the object
+ * such that it can't be deleted, the request will be silently discarded.
+ *
+ * Delete instructions made with this method will be stored locally in an on-disk cache until they can be transmitted
+ * to Parse. They will be sent immediately if possible. Otherwise, they will be sent the next time a network connection
+ * 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]
+ * 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
+ * completes.
+ */
+ destroyEventually(options?: RequestOptions): Promise;
+ /**
+ * Destroy this model on the server if it was already persisted.
+ *
+ * @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.
+ *
context: A dictionary that is accessible in Cloud Code `beforeDelete` and `afterDelete` triggers.
+ *
+ * @returns {Promise} A promise that is fulfilled when the destroy
+ * completes.
+ */
+ destroy(options: RequestOptions): Promise;
+ /**
+ * Asynchronously stores the object and every object it points to in the local datastore,
+ * recursively, using a default pin name: _default.
+ *
+ * If those other objects have not been fetched from Parse, they will not be stored.
+ * However, if they have changed data, all the changes will be retained.
+ *
+ *
+ * await object.pin();
+ *
+ *
+ * To retrieve object:
+ * query.fromLocalDatastore() or query.fromPin()
+ *
+ * @returns {Promise} A promise that is fulfilled when the pin completes.
+ */
+ pin(): Promise;
+ /**
+ * Asynchronously removes the object and every object it points to in the local datastore,
+ * recursively, using a default pin name: _default.
+ *
+ *
+ * await object.unPin();
+ *
+ *
+ * @returns {Promise} A promise that is fulfilled when the unPin completes.
+ */
+ unPin(): Promise;
+ /**
+ * Asynchronously returns if the object is pinned
+ *
+ *
+ * const isPinned = await object.isPinned();
+ *
+ *
+ * @returns {Promise} A boolean promise that is fulfilled if object is pinned.
+ */
+ isPinned(): Promise;
+ /**
+ * Asynchronously stores the objects and every object they point to in the local datastore, recursively.
+ *
+ * If those other objects have not been fetched from Parse, they will not be stored.
+ * However, if they have changed data, all the changes will be retained.
+ *
+ *
+ * await object.pinWithName(name);
+ *
+ *
+ * To retrieve object:
+ * query.fromLocalDatastore() or query.fromPinWithName(name)
+ *
+ * @param {string} name Name of Pin.
+ * @returns {Promise} A promise that is fulfilled when the pin completes.
+ */
+ pinWithName(name: string): Promise;
+ /**
+ * Asynchronously removes the object and every object it points to in the local datastore, recursively.
+ *
+ *
+ * await object.unPinWithName(name);
+ *
+ *
+ * @param {string} name Name of Pin.
+ * @returns {Promise} A promise that is fulfilled when the unPin completes.
+ */
+ unPinWithName(name: string): Promise;
+ /**
+ * Asynchronously loads data from the local datastore into this object.
+ *
+ *
+ * await object.fetchFromLocalDatastore();
+ *
+ *
+ * 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.
+ */
+ fetchFromLocalDatastore(): Promise;
+}
+import { AttributeMap as AttributeMap_1 } from './ObjectStateMutations';
+import { OpsMap } from './ObjectStateMutations';
+type SaveParams = {
+ method: string;
+ path: string;
+ body: AttributeMap;
+};
+import ParseRelation from './ParseRelation';
+import { Op } from './ParseOp';
+import { RequestOptions } from './RESTController';
+import ParseError from './ParseError';
+import ParseACL from './ParseACL';
diff --git a/types/ParseOp.d.ts b/types/ParseOp.d.ts
new file mode 100644
index 000000000..544c65a81
--- /dev/null
+++ b/types/ParseOp.d.ts
@@ -0,0 +1,76 @@
+export function opFromJSON(json: {
+ [key: string]: any;
+}): Op | null;
+export class Op {
+ applyTo(value: mixed): mixed;
+ mergeWith(previous: Op): Op | null;
+ toJSON(): mixed;
+}
+export class SetOp extends Op {
+ constructor(value: mixed);
+ _value: mixed;
+ applyTo(): mixed;
+ mergeWith(): SetOp;
+ toJSON(offline?: boolean): any;
+}
+export class UnsetOp extends Op {
+ applyTo(): any;
+ mergeWith(): UnsetOp;
+ toJSON(): {
+ __op: string;
+ };
+}
+export class IncrementOp extends Op {
+ constructor(amount: number);
+ _amount: number;
+ applyTo(value: mixed): number;
+ toJSON(): {
+ __op: string;
+ amount: number;
+ };
+}
+export class AddOp extends Op {
+ constructor(value: mixed | Array);
+ _value: Array;
+ applyTo(value: mixed): Array;
+ toJSON(): {
+ __op: string;
+ objects: mixed;
+ };
+}
+export class AddUniqueOp extends Op {
+ constructor(value: mixed | Array);
+ _value: Array;
+ applyTo(value: mixed | Array): Array;
+ toJSON(): {
+ __op: string;
+ objects: mixed;
+ };
+}
+export class RemoveOp extends Op {
+ constructor(value: mixed | Array);
+ _value: Array;
+ applyTo(value: mixed | Array): Array;
+ toJSON(): {
+ __op: string;
+ objects: mixed;
+ };
+}
+export class RelationOp extends Op {
+ constructor(adds: Array, removes: Array);
+ _targetClassName: string | null;
+ relationsToAdd: Array;
+ relationsToRemove: Array;
+ _extractId(obj: string | ParseObject): string;
+ applyTo(value: mixed, object?: {
+ className: string;
+ id: string | null;
+ }, key?: string): ParseRelation | null;
+ toJSON(): {
+ __op?: string;
+ objects?: mixed;
+ ops?: mixed;
+ };
+}
+import ParseObject from './ParseObject';
+import ParseRelation from './ParseRelation';
diff --git a/types/ParsePolygon.d.ts b/types/ParsePolygon.d.ts
new file mode 100644
index 000000000..e838e8744
--- /dev/null
+++ b/types/ParsePolygon.d.ts
@@ -0,0 +1,67 @@
+export default ParsePolygon;
+/**
+ * Creates a new Polygon with any of the following forms:
+ *
+ * new Polygon([[0,0],[0,1],[1,1],[1,0]])
+ * new Polygon([GeoPoint, GeoPoint, GeoPoint])
+ *
+ *
+ *
Represents a coordinates that may be associated
+ * with a key in a ParseObject or used as a reference point for geo queries.
+ * This allows proximity-based queries on the key.
+ *
+ *
Example:
+ * var polygon = new Parse.Polygon([[0,0],[0,1],[1,1],[1,0]]);
+ * var object = new Parse.Object("PlaceObject");
+ * object.set("area", polygon);
+ * object.save();
+ *
+ * @alias Parse.Polygon
+ */
+declare class ParsePolygon {
+ /**
+ * Validates that the list of coordinates can form a valid polygon
+ *
+ * @param {Array} coords the list of coordinates to validate as a polygon
+ * @throws {TypeError}
+ * @returns {number[][]} Array of coordinates if validated.
+ */
+ static _validate(coords: Array> | Array): Array>;
+ /**
+ * @param {(number[][] | Parse.GeoPoint[])} coordinates An Array of coordinate pairs
+ */
+ constructor(coordinates: Array> | Array);
+ _coordinates: Array>;
+ set coordinates(arg: number[][]);
+ /**
+ * Coordinates value for this Polygon.
+ * Throws an exception if not valid type.
+ *
+ * @property {(number[][] | Parse.GeoPoint[])} coordinates list of coordinates
+ * @returns {number[][]}
+ */
+ get coordinates(): number[][];
+ /**
+ * Returns a JSON representation of the Polygon, suitable for Parse.
+ *
+ * @returns {object}
+ */
+ toJSON(): {
+ __type: string;
+ coordinates: Array>;
+ };
+ /**
+ * Checks if two polygons are equal
+ *
+ * @param {(Parse.Polygon | object)} other
+ * @returns {boolean}
+ */
+ equals(other: mixed): boolean;
+ /**
+ *
+ * @param {Parse.GeoPoint} point
+ * @returns {boolean} Returns if the point is contained in the polygon
+ */
+ containsPoint(point: ParseGeoPoint): boolean;
+}
+import ParseGeoPoint from './ParseGeoPoint';
diff --git a/types/ParseQuery.d.ts b/types/ParseQuery.d.ts
new file mode 100644
index 000000000..3636ab428
--- /dev/null
+++ b/types/ParseQuery.d.ts
@@ -0,0 +1,924 @@
+type WhereClause = {
+ [attr: string]: mixed;
+};
+type QueryJSON = {
+ where: WhereClause;
+ watch?: string;
+ include?: string;
+ excludeKeys?: string;
+ keys?: string;
+ limit?: number;
+ skip?: number;
+ order?: string;
+ className?: string;
+ count?: number;
+ hint?: mixed;
+ explain?: boolean;
+ readPreference?: string;
+ includeReadPreference?: string;
+ subqueryReadPreference?: string;
+};
+export default ParseQuery;
+/**
+ * Creates a new parse Parse.Query for the given Parse.Object subclass.
+ *
+ *
Parse.Query defines a query that is used to fetch Parse.Objects. The
+ * most common use case is finding all objects that match a query through the
+ * find method. for example, this sample code fetches all objects
+ * of class myclass. it calls a different function depending on
+ * whether the fetch succeeded or not.
+ *
+ *
+ * var query = new Parse.Query(myclass);
+ * query.find().then((results) => {
+ * // results is an array of parse.object.
+ * }).catch((error) => {
+ * // error is an instance of parse.error.
+ * });
+ *
+ *
a Parse.Query can also be used to retrieve a single object whose id is
+ * known, through the get method. for example, this sample code fetches an
+ * object of class myclass and id myid. it calls a
+ * different function depending on whether the fetch succeeded or not.
+ *
+ *
+ * var query = new Parse.Query(myclass);
+ * query.get(myid).then((object) => {
+ * // object is an instance of parse.object.
+ * }).catch((error) => {
+ * // error is an instance of parse.error.
+ * });
+ *
+ *
a Parse.Query can also be used to count the number of objects that match
+ * the query without retrieving all of those objects. for example, this
+ * sample code counts the number of objects of the class myclass
+ *
+ * var query = new Parse.Query(myclass);
+ * query.count().then((number) => {
+ * // there are number instances of myclass.
+ * }).catch((error) => {
+ * // error is an instance of Parse.Error.
+ * });
+ *
+ * @alias Parse.Query
+ */
+declare class ParseQuery {
+ /**
+ * Static method to restore Parse.Query by json representation
+ * Internally calling Parse.Query.withJSON
+ *
+ * @param {string} className
+ * @param {QueryJSON} json from Parse.Query.toJSON() method
+ * @returns {Parse.Query} new created query
+ */
+ static fromJSON(className: string, json: QueryJSON): ParseQuery;
+ /**
+ * Constructs a Parse.Query that is the OR of the passed in queries. For
+ * example:
+ *
var compoundQuery = Parse.Query.or(query1, query2, query3);
+ *
+ * will create a compoundQuery that is an or of the query1, query2, and
+ * query3.
+ *
+ * @param {...Parse.Query} queries The list of queries to OR.
+ * @static
+ * @returns {Parse.Query} The query that is the OR of the passed in queries.
+ */
+ static or(...queries: Array): ParseQuery;
+ /**
+ * Constructs a Parse.Query that is the AND of the passed in queries. For
+ * example:
+ *
var compoundQuery = Parse.Query.and(query1, query2, query3);
+ *
+ * will create a compoundQuery that is an and of the query1, query2, and
+ * query3.
+ *
+ * @param {...Parse.Query} queries The list of queries to AND.
+ * @static
+ * @returns {Parse.Query} The query that is the AND of the passed in queries.
+ */
+ static and(...queries: Array): ParseQuery;
+ /**
+ * Constructs a Parse.Query that is the NOR of the passed in queries. For
+ * example:
+ *
+ *
+ * will create a compoundQuery that is a nor of the query1, query2, and
+ * query3.
+ *
+ * @param {...Parse.Query} queries The list of queries to NOR.
+ * @static
+ * @returns {Parse.Query} The query that is the NOR of the passed in queries.
+ */
+ static nor(...queries: Array): ParseQuery;
+ /**
+ * @param {(string | Parse.Object)} objectClass An instance of a subclass of Parse.Object, or a Parse className string.
+ */
+ constructor(objectClass: string | ParseObject);
+ /**
+ * @property {string} className
+ */
+ className: string;
+ _where: any;
+ _watch: Array;
+ _include: Array;
+ _exclude: Array;
+ _select: Array;
+ _limit: number;
+ _skip: number;
+ _count: boolean;
+ _order: Array;
+ _readPreference: string;
+ _includeReadPreference: string;
+ _subqueryReadPreference: string;
+ _queriesLocalDatastore: boolean;
+ _localDatastorePinName: any;
+ _extraOptions: {
+ [key: string]: mixed;
+ };
+ _hint: mixed;
+ _explain: boolean;
+ _xhrRequest: any;
+ /**
+ * Adds constraint that at least one of the passed in queries matches.
+ *
+ * @param {Array} queries
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ _orQuery(queries: Array): ParseQuery;
+ /**
+ * Adds constraint that all of the passed in queries match.
+ *
+ * @param {Array} queries
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ _andQuery(queries: Array): ParseQuery;
+ /**
+ * Adds constraint that none of the passed in queries match.
+ *
+ * @param {Array} queries
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ _norQuery(queries: Array): ParseQuery;
+ /**
+ * Helper for condition queries
+ *
+ * @param key
+ * @param condition
+ * @param value
+ * @returns {Parse.Query}
+ */
+ _addCondition(key: string, condition: string, value: mixed): ParseQuery;
+ /**
+ * Converts string for regular expression at the beginning
+ *
+ * @param string
+ * @returns {string}
+ */
+ _regexStartWith(string: string): string;
+ _handleOfflineQuery(params: any): Promise;
+ /**
+ * Returns a JSON representation of this query.
+ *
+ * @returns {object} The JSON representation of the query.
+ */
+ toJSON(): QueryJSON;
+ /**
+ * Return a query with conditions from json, can be useful to send query from server side to client
+ * Not static, all query conditions was set before calling this method will be deleted.
+ * For example on the server side we have
+ * var query = new Parse.Query("className");
+ * query.equalTo(key: value);
+ * query.limit(100);
+ * ... (others queries)
+ * Create JSON representation of Query Object
+ * var jsonFromServer = query.fromJSON();
+ *
+ * On client side getting query:
+ * var query = new Parse.Query("className");
+ * query.fromJSON(jsonFromServer);
+ *
+ * and continue to query...
+ * query.skip(100).find().then(...);
+ *
+ * @param {QueryJSON} json from Parse.Query.toJSON() method
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ withJSON(json: QueryJSON): ParseQuery;
+ /**
+ * Constructs a Parse.Object whose id is already known by fetching data from
+ * the server. Unlike the first method, it never returns undefined.
+ *
+ * @param {string} objectId The id of the object to be fetched.
+ * @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.
+ *
context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
+ *
json: Return raw json without converting to Parse.Object
+ *
+ * @returns {Promise} A promise that is resolved with the result when
+ * the query completes.
+ */
+ get(objectId: string, options?: FullOptions): Promise;
+ /**
+ * Retrieves a list of ParseObjects that satisfy this 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.
+ *
context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
+ *
json: Return raw json without converting to Parse.Object
+ *
+ * @returns {Promise} A promise that is resolved with the results when
+ * the query completes.
+ */
+ find(options?: FullOptions): Promise>;
+ /**
+ * 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
+ * the query completes.
+ */
+ findAll(options?: BatchOptions): Promise>;
+ /**
+ * Counts the number of objects that match this 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 is resolved with the count when
+ * the query completes.
+ */
+ count(options?: FullOptions): Promise;
+ /**
+ * Executes a distinct query and returns unique values
+ *
+ * @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.
+ *
+ * @returns {Promise} A promise that is resolved with the query completes.
+ */
+ distinct(key: string, options?: FullOptions): Promise>;
+ /**
+ * 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.
+ *
+ * @returns {Promise} A promise that is resolved with the query completes.
+ */
+ aggregate(pipeline: mixed, options?: FullOptions): Promise>;
+ /**
+ * Retrieves at most one Parse.Object that satisfies this query.
+ *
+ * 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
+ * behalf of a specific user.
+ *
context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
+ *
json: Return raw json without converting to Parse.Object
+ *
+ * @returns {Promise} A promise that is resolved with the object when
+ * the query completes.
+ */
+ first(options?: FullOptions): Promise;
+ /**
+ * Iterates over objects matching a query, calling a callback for each batch.
+ * If the callback returns a promise, the iteration will not continue until
+ * that promise has been fulfilled. If the callback returns a rejected
+ * promise, then iteration will stop with that error. The items are processed
+ * in an unspecified order. The query may not have any sort order, and may
+ * not use limit or skip.
+ *
+ * @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
+ * iteration has completed.
+ */
+ eachBatch(callback: (objs: Array) => Promise, options?: BatchOptions): Promise;
+ /**
+ * Iterates over each result of a query, calling a callback for each one. If
+ * the callback returns a promise, the iteration will not continue until
+ * that promise has been fulfilled. If the callback returns a rejected
+ * promise, then iteration will stop with that error. The items are
+ * processed in an unspecified order. The query may not have any sort order,
+ * and may not use limit or skip.
+ *
+ * @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.
+ *
json: Return raw json without converting to Parse.Object
+ *
+ * @returns {Promise} A promise that will be fulfilled once the
+ * iteration has completed.
+ */
+ each(callback: (obj: ParseObject) => any, options?: BatchOptions): Promise;
+ /**
+ * Adds a hint to force index selection. (https://docs.mongodb.com/manual/reference/operator/meta/hint/)
+ *
+ * @param {(string|object)} value String or Object of index that should be used when executing query
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ hint(value: mixed): ParseQuery;
+ /**
+ * Investigates the query execution plan. Useful for optimizing queries. (https://docs.mongodb.com/manual/reference/operator/meta/explain/)
+ *
+ * @param {boolean} explain Used to toggle the information on the query plan.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ explain(explain?: boolean): ParseQuery;
+ /**
+ * Iterates over each result of a query, calling a callback for each one. If
+ * the callback returns a promise, the iteration will not continue until
+ * that promise has been fulfilled. If the callback returns a rejected
+ * promise, then iteration will stop with that error. The items are
+ * processed in an unspecified order. The query may not have any sort order,
+ * and may not use limit or skip.
+ *
+ * @param {Function} callback Callback
+ *
currentObject: The current Parse.Object being processed in the array.
+ *
index: The index of the current Parse.Object being processed in the array.
+ *
query: The query map was called upon.
+ *
+ * @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
+ * iteration has completed.
+ */
+ map(callback: (currentObject: ParseObject, index: number, query: ParseQuery) => any, options?: BatchOptions): Promise>;
+ /**
+ * Iterates over each result of a query, calling a callback for each one. If
+ * the callback returns a promise, the iteration will not continue until
+ * that promise has been fulfilled. If the callback returns a rejected
+ * promise, then iteration will stop with that error. The items are
+ * processed in an unspecified order. The query may not have any sort order,
+ * and may not use limit or skip.
+ *
+ * @param {Function} callback Callback
+ *
accumulator: The accumulator accumulates the callback's return values. It is the accumulated value previously returned in the last invocation of the callback.
+ *
currentObject: The current Parse.Object being processed in the array.
+ *
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
+ * iteration has completed.
+ */
+ reduce(callback: (accumulator: any, currentObject: ParseObject, index: number) => any, initialValue: any, options?: BatchOptions): Promise>;
+ /**
+ * Iterates over each result of a query, calling a callback for each one. If
+ * the callback returns a promise, the iteration will not continue until
+ * that promise has been fulfilled. If the callback returns a rejected
+ * promise, then iteration will stop with that error. The items are
+ * processed in an unspecified order. The query may not have any sort order,
+ * and may not use limit or skip.
+ *
+ * @param {Function} callback Callback
+ *
currentObject: The current Parse.Object being processed in the array.
+ *
index: The index of the current Parse.Object being processed in the array.
+ *
query: The query filter was called upon.
+ *
+ * @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
+ * iteration has completed.
+ */
+ filter(callback: (currentObject: ParseObject, index: number, query: ParseQuery) => boolean, options?: BatchOptions): Promise>;
+ /**
+ * Adds a constraint to the query that requires a particular key's value to
+ * be equal to the provided value.
+ *
+ * @param {string} key The key to check.
+ * @param value The value that the Parse.Object must contain.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ equalTo(key: string | {
+ [key: string]: any;
+ }, value: mixed): ParseQuery;
+ /**
+ * Adds a constraint to the query that requires a particular key's value to
+ * be not equal to the provided value.
+ *
+ * @param {string} key The key to check.
+ * @param value The value that must not be equalled.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ notEqualTo(key: string | {
+ [key: string]: any;
+ }, value: mixed): ParseQuery;
+ /**
+ * Adds a constraint to the query that requires a particular key's value to
+ * be less than the provided value.
+ *
+ * @param {string} key The key to check.
+ * @param value The value that provides an upper bound.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ lessThan(key: string, value: mixed): ParseQuery;
+ /**
+ * Adds a constraint to the query that requires a particular key's value to
+ * be greater than the provided value.
+ *
+ * @param {string} key The key to check.
+ * @param value The value that provides an lower bound.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ greaterThan(key: string, value: mixed): ParseQuery;
+ /**
+ * Adds a constraint to the query that requires a particular key's value to
+ * be less than or equal to the provided value.
+ *
+ * @param {string} key The key to check.
+ * @param value The value that provides an upper bound.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ lessThanOrEqualTo(key: string, value: mixed): ParseQuery;
+ /**
+ * Adds a constraint to the query that requires a particular key's value to
+ * be greater than or equal to the provided value.
+ *
+ * @param {string} key The key to check.
+ * @param {*} value The value that provides an lower bound.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ greaterThanOrEqualTo(key: string, value: mixed): ParseQuery;
+ /**
+ * Adds a constraint to the query that requires a particular key's value to
+ * be contained in the provided list of values.
+ *
+ * @param {string} key The key to check.
+ * @param {Array<*>} value The values that will match.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ containedIn(key: string, value: Array): ParseQuery;
+ /**
+ * Adds a constraint to the query that requires a particular key's value to
+ * not be contained in the provided list of values.
+ *
+ * @param {string} key The key to check.
+ * @param {Array<*>} value The values that will not match.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ notContainedIn(key: string, value: Array): ParseQuery;
+ /**
+ * Adds a constraint to the query that requires a particular key's value to
+ * be contained by the provided list of values. Get objects where all array elements match.
+ *
+ * @param {string} key The key to check.
+ * @param {Array} values The values that will match.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ containedBy(key: string, values: Array): ParseQuery;
+ /**
+ * Adds a constraint to the query that requires a particular key's value to
+ * contain each one of the provided list of values.
+ *
+ * @param {string} key The key to check. This key's value must be an array.
+ * @param {Array} values The values that will match.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ containsAll(key: string, values: Array): ParseQuery;
+ /**
+ * Adds a constraint to the query that requires a particular key's value to
+ * contain each one of the provided list of values starting with given strings.
+ *
+ * @param {string} key The key to check. This key's value must be an array.
+ * @param {Array} values The string values that will match as starting string.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ containsAllStartingWith(key: string, values: Array): ParseQuery;
+ /**
+ * Adds a constraint for finding objects that contain the given key.
+ *
+ * @param {string} key The key that should exist.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ exists(key: string): ParseQuery;
+ /**
+ * Adds a constraint for finding objects that do not contain a given key.
+ *
+ * @param {string} key The key that should not exist
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ doesNotExist(key: string): ParseQuery;
+ /**
+ * Adds a regular expression constraint for finding string values that match
+ * the provided regular expression.
+ * This may be slow for large datasets.
+ *
+ * @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.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ matches(key: string, regex: RegExp, modifiers: string): ParseQuery;
+ /**
+ * Adds a constraint that requires that a key's value matches a Parse.Query
+ * constraint.
+ *
+ * @param {string} key The key that the contains the object to match the
+ * query.
+ * @param {Parse.Query} query The query that should match.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ matchesQuery(key: string, query: ParseQuery): ParseQuery;
+ /**
+ * Adds a constraint that requires that a key's value not matches a
+ * Parse.Query constraint.
+ *
+ * @param {string} key The key that the contains the object to match the
+ * query.
+ * @param {Parse.Query} query The query that should not match.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ doesNotMatchQuery(key: string, query: ParseQuery): ParseQuery;
+ /**
+ * Adds a constraint that requires that a key's value matches a value in
+ * an object returned by a different Parse.Query.
+ *
+ * @param {string} key The key that contains the value that is being
+ * matched.
+ * @param {string} queryKey The key in the objects returned by the query to
+ * match against.
+ * @param {Parse.Query} query The query to run.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ matchesKeyInQuery(key: string, queryKey: string, query: ParseQuery): ParseQuery;
+ /**
+ * Adds a constraint that requires that a key's value not match a value in
+ * an object returned by a different Parse.Query.
+ *
+ * @param {string} key The key that contains the value that is being
+ * excluded.
+ * @param {string} queryKey The key in the objects returned by the query to
+ * match against.
+ * @param {Parse.Query} query The query to run.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ doesNotMatchKeyInQuery(key: string, queryKey: string, query: ParseQuery): ParseQuery;
+ /**
+ * Adds a constraint for finding string values that contain a provided
+ * string. This may be slow for large datasets.
+ *
+ * @param {string} key The key that the string to match is stored in.
+ * @param {string} substring The substring that the value must contain.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ contains(key: string, substring: string): ParseQuery;
+ /**
+ * 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
+ *
+ * In order to sort you must use select and ascending ($score is required)
+ *
+ *
+ * @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.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ fullText(key: string, value: string, options: Object | null): ParseQuery;
+ /**
+ * Method to sort the full text search by text score
+ *
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ sortByTextScore(): Parse.Query;
+ /**
+ * Adds a constraint for finding string values that start with a provided
+ * string. This query will use the backend index, so it will be fast even
+ * for large datasets.
+ *
+ * @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.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ startsWith(key: string, prefix: string, modifiers: string): ParseQuery;
+ /**
+ * Adds a constraint for finding string values that end with a provided
+ * string. This will be slow for large datasets.
+ *
+ * @param {string} key The key that the string to match is stored in.
+ * @param {string} suffix The substring that the value must end with.
+ * @param {string} modifiers The regular expression mode.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ endsWith(key: string, suffix: string, modifiers: string): ParseQuery;
+ /**
+ * Adds a proximity based constraint for finding objects with key point
+ * values near the point given.
+ *
+ * @param {string} key The key that the Parse.GeoPoint is stored in.
+ * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ near(key: string, point: ParseGeoPoint): ParseQuery;
+ /**
+ * Adds a proximity based constraint for finding objects with key point
+ * values near the point given and within the maximum distance given.
+ *
+ * @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
+ * 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.
+ */
+ withinRadians(key: string, point: ParseGeoPoint, maxDistance: number, sorted: boolean): ParseQuery;
+ /**
+ * Adds a proximity based constraint for finding objects with key point
+ * values near the point given and within the maximum distance given.
+ * Radius of earth used is 3958.8 miles.
+ *
+ * @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
+ * 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.
+ */
+ withinMiles(key: string, point: ParseGeoPoint, maxDistance: number, sorted: boolean): ParseQuery;
+ /**
+ * Adds a proximity based constraint for finding objects with key point
+ * values near the point given and within the maximum distance given.
+ * Radius of earth used is 6371.0 kilometers.
+ *
+ * @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
+ * 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.
+ */
+ withinKilometers(key: string, point: ParseGeoPoint, maxDistance: number, sorted: boolean): ParseQuery;
+ /**
+ * Adds a constraint to the query that requires a particular key's
+ * coordinates be contained within a given rectangular geographic bounding
+ * box.
+ *
+ * @param {string} key The key to be constrained.
+ * @param {Parse.GeoPoint} southwest
+ * The lower-left inclusive corner of the box.
+ * @param {Parse.GeoPoint} northeast
+ * The upper-right inclusive corner of the box.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ withinGeoBox(key: string, southwest: ParseGeoPoint, northeast: ParseGeoPoint): ParseQuery;
+ /**
+ * Adds a constraint to the query that requires a particular key's
+ * coordinates be contained within and on the bounds of a given polygon.
+ * Supports closed and open (last point is connected to first) paths
+ *
+ * Polygon must have at least 3 points
+ *
+ * @param {string} key The key to be constrained.
+ * @param {Array} points Array of Coordinates / GeoPoints
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ withinPolygon(key: string, points: Array>): ParseQuery;
+ /**
+ * Add a constraint to the query that requires a particular key's
+ * coordinates that contains a ParseGeoPoint
+ *
+ * @param {string} key The key to be constrained.
+ * @param {Parse.GeoPoint} point
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ polygonContains(key: string, point: ParseGeoPoint): ParseQuery;
+ /**
+ * Sorts the results in ascending order by the given key.
+ *
+ * @param {(string|string[])} keys The key to order by, which is a
+ * string of comma separated values, or an Array of keys, or multiple keys.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ ascending(...keys: Array): ParseQuery;
+ /**
+ * Sorts the results in ascending order by the given key,
+ * but can also add secondary sort descriptors without overwriting _order.
+ *
+ * @param {(string|string[])} keys The key to order by, which is a
+ * string of comma separated values, or an Array of keys, or multiple keys.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ addAscending(...keys: Array): ParseQuery;
+ /**
+ * Sorts the results in descending order by the given key.
+ *
+ * @param {(string|string[])} keys The key to order by, which is a
+ * string of comma separated values, or an Array of keys, or multiple keys.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ descending(...keys: Array): ParseQuery;
+ /**
+ * Sorts the results in descending order by the given key,
+ * but can also add secondary sort descriptors without overwriting _order.
+ *
+ * @param {(string|string[])} keys The key to order by, which is a
+ * string of comma separated values, or an Array of keys, or multiple keys.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ addDescending(...keys: Array): ParseQuery;
+ /**
+ * Sets the number of results to skip before returning any results.
+ * This is useful for pagination.
+ * Default is to skip zero results.
+ *
+ * @param {number} n the number of results to skip.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ skip(n: number): ParseQuery;
+ /**
+ * Sets the limit of the number of results to return. The default limit is 100.
+ *
+ * @param {number} n the number of results to limit to.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ limit(n: number): 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
+ *
+ * @param {boolean} includeCount false - disable, true - enable.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ withCount(includeCount?: boolean): ParseQuery;
+ /**
+ * Includes nested Parse.Objects for the provided key. You can use dot
+ * notation to specify which fields in the included object are also fetched.
+ *
+ * You can include all nested Parse.Objects by passing in '*'.
+ * 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.
+ */
+ include(...keys: Array>): ParseQuery;
+ /**
+ * Includes all nested Parse.Objects one level deep.
+ *
+ * Requires Parse Server 3.0.0+
+ *
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ includeAll(): ParseQuery;
+ /**
+ * Restricts the fields of the returned Parse.Objects to include only the
+ * provided keys. If this is called multiple times, then all of the keys
+ * specified in each of the calls will be included.
+ *
+ * @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.
+ */
+ select(...keys: Array>): ParseQuery;
+ /**
+ * Restricts the fields of the returned Parse.Objects to all keys except the
+ * provided keys. Exclude takes precedence over select and include.
+ *
+ * Requires Parse Server 3.6.0+
+ *
+ * @param {...string|Array} keys The name(s) of the key(s) to exclude.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ exclude(...keys: Array>): ParseQuery;
+ /**
+ * Restricts live query to trigger only for watched fields.
+ *
+ * Requires Parse Server 6.0.0+
+ *
+ * @param {...string|Array} keys The name(s) of the key(s) to watch.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ watch(...keys: Array>): ParseQuery;
+ /**
+ * Changes the read preference that the backend will use when performing the query to the database.
+ *
+ * @param {string} readPreference The read preference for the main query.
+ * @param {string} includeReadPreference The read preference for the queries to include pointers.
+ * @param {string} subqueryReadPreference The read preference for the sub queries.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ readPreference(readPreference: string, includeReadPreference?: string, subqueryReadPreference?: string): ParseQuery;
+ /**
+ * Subscribe this query to get liveQuery updates
+ *
+ * @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.
+ */
+ subscribe(sessionToken?: string): Promise;
+ /**
+ * Change the source of this query to the server.
+ *
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ fromNetwork(): ParseQuery;
+ /**
+ * Changes the source of this query to all pinned objects.
+ *
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ fromLocalDatastore(): ParseQuery;
+ /**
+ * Changes the source of this query to the default group of pinned objects.
+ *
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ fromPin(): ParseQuery;
+ /**
+ * Changes the source of this query to a specific group of pinned objects.
+ *
+ * @param {string} name The name of query source.
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ fromPinWithName(name?: string): ParseQuery;
+ /**
+ * Cancels the current network request (if any is running).
+ *
+ * @returns {Parse.Query} Returns the query, so you can chain this call.
+ */
+ cancel(): ParseQuery;
+ _setRequestTask(options: any): void;
+}
+import { FullOptions } from './RESTController';
+import ParseObject from './ParseObject';
+type BatchOptions = FullOptions & {
+ batchSize?: number;
+};
+import ParseGeoPoint from './ParseGeoPoint';
+import LiveQuerySubscription from './LiveQuerySubscription';
diff --git a/types/ParseRelation.d.ts b/types/ParseRelation.d.ts
new file mode 100644
index 000000000..2815a6e87
--- /dev/null
+++ b/types/ParseRelation.d.ts
@@ -0,0 +1,56 @@
+export default ParseRelation;
+/**
+ * Creates a new Relation for the given parent object and key. This
+ * constructor should rarely be used directly, but rather created by
+ * Parse.Object.relation.
+ *
+ *
+ * A class that is used to access all of the children of a many-to-many
+ * relationship. Each instance of Parse.Relation is associated with a
+ * particular parent object and key.
+ *
+ *
+ * @alias Parse.Relation
+ */
+declare class ParseRelation {
+ /**
+ * @param {Parse.Object} parent The parent of this relation.
+ * @param {string} key The key for this relation on the parent.
+ */
+ constructor(parent: ParseObject | null, key: string | null);
+ parent: ParseObject | null;
+ key: string | null;
+ targetClassName: string | null;
+ _ensureParentAndKey(parent: ParseObject, key: string): void;
+ /**
+ * Adds a Parse.Object or an array of Parse.Objects to the relation.
+ *
+ * @param {(Parse.Object|Array)} objects The item or items to add.
+ * @returns {Parse.Object} The parent of the relation.
+ */
+ add(objects: ParseObject | Array): ParseObject;
+ /**
+ * Removes a Parse.Object or an array of Parse.Objects from this relation.
+ *
+ * @param {(Parse.Object|Array)} objects The item or items to remove.
+ */
+ remove(objects: ParseObject | Array): void;
+ /**
+ * Returns a JSON version of the object suitable for saving to disk.
+ *
+ * @returns {object} JSON representation of Relation
+ */
+ toJSON(): {
+ __type: 'Relation';
+ className: string | null;
+ };
+ /**
+ * Returns a Parse.Query that is limited to objects in this
+ * relation.
+ *
+ * @returns {Parse.Query} Relation Query
+ */
+ query(): ParseQuery;
+}
+import ParseObject from './ParseObject';
+import ParseQuery from './ParseQuery';
diff --git a/types/ParseRole.d.ts b/types/ParseRole.d.ts
new file mode 100644
index 000000000..b77c9c944
--- /dev/null
+++ b/types/ParseRole.d.ts
@@ -0,0 +1,78 @@
+export default ParseRole;
+/**
+ * Represents a Role on the Parse server. Roles represent groupings of
+ * Users for the purposes of granting permissions (e.g. specifying an ACL
+ * for an Object). Roles are specified by their sets of child users and
+ * child roles, all of which are granted any permissions that the parent
+ * role has.
+ *
+ *
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
+ */
+declare class ParseRole {
+ /**
+ * @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);
+ /**
+ * Gets the name of the role. You can alternatively call role.get("name")
+ *
+ * @returns {string} the name of the role.
+ */
+ getName(): string | null;
+ /**
+ * Sets the name for a role. This value must be set before the role has
+ * been saved to the server, and cannot be set once the role has been
+ * saved.
+ *
+ *
+ * A role's name can only contain alphanumeric characters, _, -, and
+ * spaces.
+ *
+ *
+ *
This is equivalent to calling role.set("name", name)
+ *
+ * @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.
+ */
+ setName(name: string, options?: mixed): ParseObject | boolean;
+ /**
+ * Gets the Parse.Relation for the Parse.Users that are direct
+ * children of this role. These users are granted any privileges that this
+ * role has been granted (e.g. read or write access through ACLs). You can
+ * add or remove users from the role through this relation.
+ *
+ *
This is equivalent to calling role.relation("users")
+ *
+ * @returns {Parse.Relation} the relation for the users belonging to this
+ * role.
+ */
+ getUsers(): ParseRelation;
+ /**
+ * Gets the Parse.Relation for the Parse.Roles that are direct
+ * children of this role. These roles' users are granted any privileges that
+ * this role has been granted (e.g. read or write access through ACLs). You
+ * can add or remove child roles from this role through this relation.
+ *
+ *
This is equivalent to calling role.relation("roles")
+ *
+ * @returns {Parse.Relation} the relation for the roles belonging to this
+ * role.
+ */
+ getRoles(): ParseRelation;
+ _validateName(newName: any): void;
+ validate(attrs: AttributeMap, options?: mixed): ParseError | boolean;
+}
+import ParseObject from './ParseObject';
+import ParseRelation from './ParseRelation';
+import { AttributeMap } from './ObjectStateMutations';
+import ParseError from './ParseError';
+import ParseACL from './ParseACL';
diff --git a/types/ParseSchema.d.ts b/types/ParseSchema.d.ts
new file mode 100644
index 000000000..e71cc362b
--- /dev/null
+++ b/types/ParseSchema.d.ts
@@ -0,0 +1,227 @@
+export default ParseSchema;
+/**
+ * A Parse.Schema object is for handling schema data from Parse.
+ *
All the schemas methods require MasterKey.
+ *
+ * When adding fields, you may set required and default values. (Requires Parse Server 3.7.0+)
+ *
+ *
+ *
+ *
+ * @alias Parse.Schema
+ */
+declare class ParseSchema {
+ /**
+ * Static method to get all schemas
+ *
+ * @returns {Promise} A promise that is resolved with the result when
+ * the query completes.
+ */
+ static all(): Promise;
+ /**
+ * @param {string} className Parse Class string.
+ */
+ constructor(className: string);
+ className: string;
+ _fields: {
+ [key: string]: mixed;
+ };
+ _indexes: {
+ [key: string]: mixed;
+ };
+ _clp: {
+ [key: string]: mixed;
+ };
+ /**
+ * Get the Schema from Parse
+ *
+ * @returns {Promise} A promise that is resolved with the result when
+ * the query completes.
+ */
+ get(): Promise;
+ /**
+ * Create a new Schema on Parse
+ *
+ * @returns {Promise} A promise that is resolved with the result when
+ * the query completes.
+ */
+ save(): Promise;
+ /**
+ * Update a Schema on Parse
+ *
+ * @returns {Promise} A promise that is resolved with the result when
+ * the query completes.
+ */
+ update(): Promise;
+ /**
+ * Removing a Schema from Parse
+ * Can only be used on Schema without objects
+ *
+ * @returns {Promise} A promise that is resolved with the result when
+ * the query completes.
+ */
+ delete(): Promise;
+ /**
+ * 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
+ * the query completes.
+ */
+ purge(): Promise;
+ /**
+ * Assert if ClassName has been filled
+ *
+ * @private
+ */
+ private assertClassName;
+ /**
+ * Sets Class Level Permissions when creating / updating a Schema.
+ * EXERCISE CAUTION, running this may override CLP for this schema and cannot be reversed
+ *
+ * @param {object | Parse.CLP} clp Class Level Permissions
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ */
+ setCLP(clp: PermissionsMap | ParseCLP): Parse.Schema;
+ /**
+ * 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
+ * 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+)
+ *
targetClass: Required if type is Pointer or Parse.Relation
+ *
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ */
+ addField(name: string, type: string, options?: FieldOptions): Parse.Schema;
+ /**
+ * Adding an Index to Create / Update a Schema
+ *
+ * @param {string} name Name of the index
+ * @param {object} index { field: value }
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ *
+ *
+ */
+ addIndex(name: string, index: any): Parse.Schema;
+ /**
+ * 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}
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ */
+ addString(name: string, options: FieldOptions): Parse.Schema;
+ /**
+ * 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}
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ */
+ addNumber(name: string, options: FieldOptions): Parse.Schema;
+ /**
+ * 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}
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ */
+ addBoolean(name: string, options: FieldOptions): Parse.Schema;
+ /**
+ * 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}
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ */
+ addDate(name: string, options: FieldOptions): Parse.Schema;
+ /**
+ * 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}
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ */
+ addFile(name: string, options: FieldOptions): Parse.Schema;
+ /**
+ * 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}
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ */
+ addGeoPoint(name: string, options: FieldOptions): Parse.Schema;
+ /**
+ * 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}
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ */
+ addPolygon(name: string, options: FieldOptions): Parse.Schema;
+ /**
+ * 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}
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ */
+ addArray(name: string, options: FieldOptions): Parse.Schema;
+ /**
+ * 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}
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ */
+ addObject(name: string, options: FieldOptions): Parse.Schema;
+ /**
+ * Adding Pointer Field
+ *
+ * @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}
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ */
+ addPointer(name: string, targetClass: string, options?: FieldOptions): Parse.Schema;
+ /**
+ * Adding Relation Field
+ *
+ * @param {string} name Name of the field that will be created on Parse
+ * @param {string} targetClass Name of the target Pointer Class
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ */
+ addRelation(name: string, targetClass: string): Parse.Schema;
+ /**
+ * Deleting a Field to Update on a Schema
+ *
+ * @param {string} name Name of the field
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ */
+ deleteField(name: string): Parse.Schema;
+ /**
+ * Deleting an Index to Update on a Schema
+ *
+ * @param {string} name Name of the field
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
+ */
+ deleteIndex(name: string): Parse.Schema;
+}
+import { PermissionsMap } from './ParseCLP';
+import ParseCLP from './ParseCLP';
+type FieldOptions = {
+ required: boolean;
+ defaultValue: mixed;
+};
diff --git a/types/ParseSession.d.ts b/types/ParseSession.d.ts
new file mode 100644
index 000000000..6c3334b8a
--- /dev/null
+++ b/types/ParseSession.d.ts
@@ -0,0 +1,45 @@
+export default ParseSession;
+/**
+ *
A Parse.Session object is a local representation of a revocable session.
+ * This class is a subclass of a Parse.Object, and retains the same
+ * functionality of a Parse.Object.
+ *
+ * @alias Parse.Session
+ * @augments Parse.Object
+ */
+declare class ParseSession {
+ static readOnlyAttributes(): string[];
+ /**
+ * Retrieves the Session object for the currently logged in session.
+ *
+ * @param {object} options useMasterKey
+ * @static
+ * @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.
+ */
+ static current(options: FullOptions): Promise;
+ /**
+ * Determines whether the current session token is revocable.
+ * This method is useful for migrating Express.js or Node.js web apps to
+ * use revocable sessions. If you are migrating an app that uses the Parse
+ * SDK in the browser only, please use Parse.User.enableRevocableSession()
+ * instead, so that sessions can be automatically upgraded.
+ *
+ * @static
+ * @returns {boolean}
+ */
+ static isCurrentSessionRevocable(): boolean;
+ /**
+ * @param {object} attributes The initial set of data to store in the user.
+ */
+ constructor(attributes: AttributeMap | null);
+ /**
+ * Returns the session token string.
+ *
+ * @returns {string}
+ */
+ getSessionToken(): string;
+}
+import { FullOptions } from './RESTController';
+import { AttributeMap } from './ObjectStateMutations';
diff --git a/types/ParseUser.d.ts b/types/ParseUser.d.ts
new file mode 100644
index 000000000..fe8380c4c
--- /dev/null
+++ b/types/ParseUser.d.ts
@@ -0,0 +1,470 @@
+type AuthData = {
+ [key: string]: mixed;
+};
+export default ParseUser;
+/**
+ *
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.
+ *
+ * @alias Parse.User
+ * @augments Parse.Object
+ */
+declare class ParseUser {
+ static readOnlyAttributes(): string[];
+ /**
+ * Adds functionality to the existing Parse.User class.
+ *
+ * @param {object} protoProps A set of properties to add to the prototype
+ * @param {object} classProps A set of static properties to add to the class
+ * @static
+ * @returns {Parse.User} The newly extended Parse.User class
+ */
+ static extend(protoProps: {
+ [prop: string]: any;
+ }, classProps: {
+ [prop: string]: any;
+ }): Parse.User;
+ /**
+ * Retrieves the currently logged in ParseUser with a valid session,
+ * either from memory or localStorage, if necessary.
+ *
+ * @static
+ * @returns {Parse.Object} The currently logged in Parse.User.
+ */
+ static current(): ParseUser | null;
+ /**
+ * Retrieves the currently logged in ParseUser from asynchronous Storage.
+ *
+ * @static
+ * @returns {Promise} A Promise that is resolved with the currently
+ * logged in Parse User
+ */
+ static currentAsync(): Promise;
+ /**
+ * Signs up a new user with a username (or email) and password.
+ * This will create a new Parse.User on the server, and also persist the
+ * session in localStorage so that you can access the user using
+ * {@link #current}.
+ *
+ * @param {string} username The username (or email) to sign up with.
+ * @param {string} password The password to sign up with.
+ * @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
+ * the signup completes.
+ */
+ static signUp(username: string, password: string, attrs: AttributeMap, options?: FullOptions): Promise;
+ /**
+ * Logs in a user with a username (or email) and password. On success, this
+ * saves the session to disk, so you can retrieve the currently logged in
+ * user using current.
+ *
+ * @param {string} username The username (or email) to log in with.
+ * @param {string} password The password to log in with.
+ * @param {object} options
+ * @static
+ * @returns {Promise} A promise that is fulfilled with the user when
+ * the login completes.
+ */
+ static logIn(username: string, password: string, options?: FullOptions): Promise;
+ /**
+ * Logs in a user with a username (or email) and password, and authData. On success, this
+ * saves the session to disk, so you can retrieve the currently logged in
+ * user using current.
+ *
+ * @param {string} username The username (or email) to log in with.
+ * @param {string} password The password to log in with.
+ * @param {object} authData The authData to log in with.
+ * @param {object} options
+ * @static
+ * @returns {Promise} A promise that is fulfilled with the user when
+ * the login completes.
+ */
+ static logInWithAdditionalAuth(username: string, password: string, authData: AuthData, options?: FullOptions): Promise;
+ /**
+ * Logs in a user with an objectId. On success, this saves the session
+ * to disk, so you can retrieve the currently logged in user using
+ * current.
+ *
+ * @param {string} userId The objectId for the user.
+ * @static
+ * @returns {Promise} A promise that is fulfilled with the user when
+ * the login completes.
+ */
+ static loginAs(userId: string): Promise;
+ /**
+ * Logs in a user with a session token. On success, this saves the session
+ * to disk, so you can retrieve the currently logged in user using
+ * current.
+ *
+ * @param {string} sessionToken The sessionToken to log in with.
+ * @param {object} options
+ * @static
+ * @returns {Promise} A promise that is fulfilled with the user when
+ * the login completes.
+ */
+ static become(sessionToken: string, options?: RequestOptions): Promise;
+ /**
+ * Retrieves a user with a session token.
+ *
+ * @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.
+ */
+ static me(sessionToken: string, options?: RequestOptions): Promise;
+ /**
+ * Logs in a user with a session token. On success, this saves the session
+ * to disk, so you can retrieve the currently logged in user using
+ * current. If there is no session token the user will not logged in.
+ *
+ * @param {object} userJSON The JSON map of the User's data
+ * @static
+ * @returns {Promise} A promise that is fulfilled with the user when
+ * the login completes.
+ */
+ static hydrate(userJSON: AttributeMap): Promise;
+ /**
+ * Static version of {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith}
+ *
+ * @param provider
+ * @param options
+ * @param saveOpts
+ * @static
+ * @returns {Promise}
+ */
+ static logInWith(provider: any, options: {
+ authData?: AuthData;
+ }, saveOpts?: FullOptions): Promise;
+ /**
+ * Logs out the currently logged in user session. This will remove the
+ * session from disk, log out of linked services, and future calls to
+ * current will return null.
+ *
+ * @param {object} options
+ * @static
+ * @returns {Promise} A promise that is resolved when the session is
+ * destroyed on the server.
+ */
+ static logOut(options?: RequestOptions): Promise;
+ /**
+ * Requests a password reset email to be sent to the specified email address
+ * associated with the user account. This email allows the user to securely
+ * reset their password on the Parse site.
+ *
+ * @param {string} email The email address associated with the user that
+ * forgot their password.
+ * @param {object} options
+ * @static
+ * @returns {Promise}
+ */
+ static requestPasswordReset(email: string, options?: RequestOptions): Promise;
+ /**
+ * Request an email verification.
+ *
+ * @param {string} email The email address associated with the user that
+ * needs to verify their email.
+ * @param {object} options
+ * @static
+ * @returns {Promise}
+ */
+ static requestEmailVerification(email: string, options?: RequestOptions): Promise;
+ /**
+ * Verify whether a given password is the password of the current user.
+ *
+ * @param {string} username A username to be used for identificaiton
+ * @param {string} password A password to be verified
+ * @param {object} options
+ * @static
+ * @returns {Promise} A promise that is fulfilled with a user
+ * when the password is correct.
+ */
+ static verifyPassword(username: string, password: string, options?: RequestOptions): Promise;
+ /**
+ * Allow someone to define a custom User class without className
+ * being rewritten to _User. The default behavior is to rewrite
+ * User to _User for legacy reasons. This allows developers to
+ * override that behavior.
+ *
+ * @param {boolean} isAllowed Whether or not to allow custom User class
+ * @static
+ */
+ static allowCustomUserClass(isAllowed: boolean): void;
+ /**
+ * Allows a legacy application to start using revocable sessions. If the
+ * current session token is not revocable, a request will be made for a new,
+ * revocable session.
+ * It is not necessary to call this method from cloud code unless you are
+ * handling user signup or login from the server side. In a cloud code call,
+ * this function will not attempt to upgrade the current token.
+ *
+ * @param {object} options
+ * @static
+ * @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.
+ */
+ static enableRevocableSession(options?: RequestOptions): Promise;
+ /**
+ * Enables the use of become or the current user in a server
+ * environment. These features are disabled by default, since they depend on
+ * global objects that are not memory-safe for most servers.
+ *
+ * @static
+ */
+ static enableUnsafeCurrentUser(): void;
+ /**
+ * Disables the use of become or the current user in any environment.
+ * These features are disabled on servers by default, since they depend on
+ * global objects that are not memory-safe for most servers.
+ *
+ * @static
+ */
+ static disableUnsafeCurrentUser(): void;
+ /**
+ * When registering users with {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith} a basic auth provider
+ * is automatically created for you.
+ *
+ * For advanced authentication, you can register an Auth provider to
+ * implement custom authentication, deauthentication.
+ *
+ * @param provider
+ * @see {@link https://parseplatform.org/Parse-SDK-JS/api/master/AuthProvider.html AuthProvider}
+ * @see {@link https://docs.parseplatform.org/js/guide/#custom-authentication-module Custom Authentication Module}
+ * @static
+ */
+ static _registerAuthenticationProvider(provider: any): void;
+ /**
+ * @param provider
+ * @param options
+ * @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}
+ */
+ static _logInWith(provider: any, options: {
+ authData?: AuthData;
+ }, saveOpts?: FullOptions): Promise;
+ static _clearCache(): void;
+ static _setCurrentUserCache(user: ParseUser): void;
+ /**
+ * @param {object} attributes The initial set of data to store in the user.
+ */
+ constructor(attributes: AttributeMap | null);
+ /**
+ * 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
+ * token has been fetched.
+ */
+ _upgradeToRevocableSession(options: RequestOptions): Promise;
+ /**
+ * 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
+ * your users to sign up or log into your application using their existing identities.
+ * Since 2.9.0
+ *
+ * @see {@link https://docs.parseplatform.org/js/guide/#linking-users Linking Users}
+ * @param {string | AuthProvider} provider Name of auth provider or {@link https://parseplatform.org/Parse-SDK-JS/api/master/AuthProvider.html AuthProvider}
+ * @param {object} options
+ *
+ *
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
+ */
+ linkWith(provider: any, options: {
+ authData?: AuthData;
+ }, saveOpts?: FullOptions): Promise;
+ /**
+ * @param provider
+ * @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}
+ */
+ _linkWith(provider: any, options: {
+ authData?: AuthData;
+ }, saveOpts?: FullOptions): Promise;
+ /**
+ * Synchronizes auth data for a provider (e.g. puts the access token in the
+ * right place to be used by the Facebook SDK).
+ *
+ * @param provider
+ */
+ _synchronizeAuthData(provider: string): void;
+ /**
+ * Synchronizes authData for all providers.
+ */
+ _synchronizeAllAuthData(): void;
+ /**
+ * Removes null values from authData (which exist temporarily for unlinking)
+ */
+ _cleanupAuthData(): void;
+ /**
+ * 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
+ * finishes.
+ */
+ _unlinkFrom(provider: any, options?: FullOptions): Promise;
+ /**
+ * Checks whether a user is linked to a service.
+ *
+ * @param {object} provider service to link to
+ * @returns {boolean} true if link was successful
+ */
+ _isLinked(provider: any): boolean;
+ /**
+ * Deauthenticates all providers.
+ */
+ _logOutWithAll(): void;
+ /**
+ * Deauthenticates a single provider (e.g. removing access tokens from the
+ * Facebook SDK).
+ *
+ * @param {object} provider service to logout of
+ */
+ _logOutWith(provider: any): void;
+ /**
+ * Class instance method used to maintain specific keys when a fetch occurs.
+ * Used to ensure that the session token is not lost.
+ *
+ * @returns {object} sessionToken
+ */
+ _preserveFieldsOnFetch(): AttributeMap;
+ /**
+ * Returns true if current would return this user.
+ *
+ * @returns {boolean} true if user is cached on disk
+ */
+ isCurrent(): boolean;
+ /**
+ * Returns true if current would return this user.
+ *
+ * @returns {Promise} true if user is cached on disk
+ */
+ isCurrentAsync(): Promise;
+ /**
+ * Returns get("username").
+ *
+ * @returns {string}
+ */
+ getUsername(): string | null;
+ /**
+ * Calls set("username", username, options) and returns the result.
+ *
+ * @param {string} username
+ */
+ setUsername(username: string): void;
+ /**
+ * Calls set("password", password, options) and returns the result.
+ *
+ * @param {string} password User's Password
+ */
+ setPassword(password: string): void;
+ /**
+ * Returns get("email").
+ *
+ * @returns {string} User's Email
+ */
+ getEmail(): string | null;
+ /**
+ * Calls set("email", email) and returns the result.
+ *
+ * @param {string} email
+ * @returns {boolean}
+ */
+ setEmail(email: string): boolean;
+ /**
+ * Returns the session token for this user, if the user has been logged in,
+ * or if it is the result of a query with the master key. Otherwise, returns
+ * undefined.
+ *
+ * @returns {string} the session token, or undefined
+ */
+ getSessionToken(): string | null;
+ /**
+ * Checks whether this user is the current user and has been authenticated.
+ *
+ * @returns {boolean} whether this user is the current user and is logged in.
+ */
+ authenticated(): boolean;
+ /**
+ * Signs up a new user. You should call this instead of save for
+ * new Parse.Users. This will create a new Parse.User on the server, and
+ * also persist the session on disk so that you can access the user using
+ * current.
+ *
+ *
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
+ * finishes.
+ */
+ signUp(attrs: AttributeMap, options?: FullOptions): Promise;
+ /**
+ * Logs in a Parse.User. On success, this saves the session to disk,
+ * so you can retrieve the currently logged in user using
+ * current.
+ *
+ *
A username and password must be set before calling logIn.
+ *
+ * @param {object} options
+ * @returns {Promise} A promise that is fulfilled with the user when
+ * the login is complete.
+ */
+ logIn(options?: FullOptions): Promise;
+ /**
+ * Wrap the default save behavior with functionality to save to local
+ * storage if this is current user.
+ *
+ * @param {...any} args
+ * @returns {Promise}
+ */
+ save(...args: Array): Promise;
+ /**
+ * Wrap the default destroy behavior with functionality that logs out
+ * the current user when it is destroyed
+ *
+ * @param {...any} args
+ * @returns {Parse.User}
+ */
+ destroy(...args: Array): Promise;
+ /**
+ * Wrap the default fetch behavior with functionality to save to local
+ * storage if this is current user.
+ *
+ * @param {...any} args
+ * @returns {Parse.User}
+ */
+ fetch(...args: Array): Promise;
+ /**
+ * Wrap the default fetchWithInclude behavior with functionality to save to local
+ * storage if this is current user.
+ *
+ * @param {...any} args
+ * @returns {Parse.User}
+ */
+ fetchWithInclude(...args: Array): Promise;
+ /**
+ * Verify whether a given password is the password of the current user.
+ *
+ * @param {string} password A password to be verified
+ * @param {object} options
+ * @returns {Promise} A promise that is fulfilled with a user
+ * when the password is correct.
+ */
+ verifyPassword(password: string, options?: RequestOptions): Promise;
+}
+import { RequestOptions } from './RESTController';
+import { FullOptions } from './RESTController';
+import { AttributeMap } from './ObjectStateMutations';
diff --git a/types/Push.d.ts b/types/Push.d.ts
new file mode 100644
index 000000000..5b402a633
--- /dev/null
+++ b/types/Push.d.ts
@@ -0,0 +1,58 @@
+/**
+ * Contains functions to deal with Push in Parse.
+ *
+ * @class Parse.Push
+ * @static
+ * @hideconstructor
+ */
+/**
+ * Sends a push notification.
+ * **Available in Cloud Code only.**
+ *
+ * See {@link https://docs.parseplatform.org/js/guide/#push-notifications Push Notification Guide}
+ *
+ * @function send
+ * @name Parse.Push.send
+ * @param {object} data - The data of the push notification. Valid fields
+ * are:
+ *
+ *
channels - An Array of channels to push to.
+ *
push_time - A Date object for when to send the push.
+ *
expiration_time - A Date object for when to expire
+ * the push.
+ *
expiration_interval - The seconds from now to expire the push.
+ *
where - A Parse.Query over Parse.Installation that is used to match
+ * a set of installations to push to.