import ParseACL from './ParseACL'; import ParseError from './ParseError'; import ParseFile from './ParseFile'; import { Op } from './ParseOp'; import ParseRelation from './ParseRelation'; import type { AttributeMap, OpsMap } from './ObjectStateMutations'; import type { RequestOptions, FullOptions, BaseRequestOptions } from './RESTController'; import type ParseGeoPoint from './ParseGeoPoint'; import type ParsePolygon from './ParsePolygon'; export interface Pointer { __type: string; className: string; objectId?: string; _localId?: string; } interface SaveParams { method: string; path: string; body: AttributeMap; } export interface SaveOptions extends BaseRequestOptions { /** If `false`, nested objects will not be saved (default is `true`). */ cascadeSave?: boolean; batchSize?: number; transaction?: boolean; } export interface FetchOptions extends BaseRequestOptions { include?: string | string[]; } export interface SetOptions { ignoreValidation?: boolean; unset?: boolean; } export type DestroyOptions = BaseRequestOptions; /** Options for destroyAll batch operation */ export interface DestroyAllOptions extends BaseRequestOptions { /** batchSize: How many objects to yield in each batch (default: 20) */ batchSize?: number; /** Set to true to enable transactions */ transaction?: boolean; } /** Options for saveAll batch operation */ export interface SaveAllOptions extends BaseRequestOptions { /** batchSize: How many objects to yield in each batch (default: 20) */ batchSize?: number; /** If `false`, nested objects will not be saved (default is `true`). */ cascadeSave?: boolean; /** Set to true to enable transactions */ transaction?: boolean; } /** Options for fetchAll batch operation */ export interface FetchAllOptions extends BaseRequestOptions { include?: string | string[]; } export type AttributeKey = Extract; export type Attributes = Record; export interface JSONBaseAttributes { objectId: string; createdAt: string; updatedAt: string; } export interface BaseAttributes { objectId: string; createdAt: Date; updatedAt: Date; } interface CommonAttributes { ACL: ParseACL; } type AtomicKey = { [K in keyof T]: NonNullable extends any[] ? K : never; }; export type Encode = T extends ParseObject ? ReturnType | Pointer : T extends ParseACL | ParseGeoPoint | ParsePolygon | ParseRelation | ParseFile ? ReturnType : T extends Date ? { __type: 'Date'; iso: string; } : T extends RegExp ? string : T extends (infer R)[] ? Encode[] : T extends object ? ToJSON : T; export type ToJSON = { [K in keyof T]: Encode; }; /** * Creates a new model with defined attributes. * *

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 { /** * @param {string} className The class name for the object * @param {object} attributes The initial set of data to store in the object. * @param {object} options The options for this object instance. * @param {boolean} [options.ignoreValidation] Set to `true` ignore any attribute validation errors. */ constructor(className?: string | { className: string; [attr: string]: any; }, attributes?: T, options?: SetOptions); /** * The ID of this object, unique within its class. * * @property {string} id */ id?: string; _localId?: string; _objCount: number; className: string; get attributes(): T; /** * The first time this object was saved on the server. * * @property {Date} createdAt * @returns {Date} */ get createdAt(): Date | undefined; /** * The last time this object was updated on the server. * * @property {Date} updatedAt * @returns {Date} */ get updatedAt(): Date | undefined; /** * 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(): Attributes; _clearServerData(): void; _getPendingOps(): OpsMap[]; /** * @param {Array} [keysToClear] - if specified, only ops matching * these fields will be cleared */ _clearPendingOps(keysToClear?: string[]): void; _getDirtyObjectAttributes(): Attributes; _toFullJSON(seen?: any[], offline?: boolean): Attributes; _getSaveJSON(): Attributes; _getSaveParams(): SaveParams; _finishFetch(serverData: Attributes): void; _setExisted(existed: boolean): void; _migrateId(serverId: string): void; _handleSaveResponse(response: Attributes, status: number): void; _handleSaveError(): void; static _getClassMap(): AttributeMap; static _getRequestOptions(options?: RequestOptions & FullOptions & { json?: boolean; }): RequestOptions & FullOptions & { json?: boolean; }; initialize(): void; /** * Returns a JSON version of the object suitable for saving to Parse. * * @param seen * @param offline * @returns {object} */ toJSON(seen?: any[], offline?: boolean): ToJSON & JSONBaseAttributes; /** * Determines whether this ParseObject is equal to another ParseObject * * @param {object} other - An other object ot compare * @returns {boolean} */ equals(other: T): 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?: K): boolean; /** * Returns an array of keys that have been modified since last save/refresh * * @returns {string[]} */ dirtyKeys(): string[]; /** * 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: K): T[K]; /** * Gets a relation on the given class for the attribute. * * @param {string} attr The attribute to get the relation for. * @returns {Parse.Relation} */ relation = AttributeKey>(attr: T[K] extends ParseRelation ? K : never): ParseRelation; /** * Gets the HTML-escaped value of an attribute. * * @param {string} attr The string name of an attribute. * @returns {string} */ escape>(attr: K): 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: K): 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:

     *   gameTurn.set({
     *     player: player1,
     *     diceRoll: 2
     *   }, {
     *     error: function(gameTurnAgain, error) {
     *       // The set failed validation.
     *     }
     *   });
     *
     *   game.set("currentPlayer", player2, {
     *     error: function(gameTurnAgain, error) {
     *       // The set failed validation.
     *     }
     *   });
     *
     *   game.set("finished", true);

* * game.set("player.score", 10);

* * @param {(string|object)} key The key to set. * @param {(string|object)} value The value to give it. * @param {object} options A set of options for the set. * The only supported option is error. * @returns {Parse.Object} Returns the object, so you can chain this call. */ set>(key: K | (Pick | T), value?: SetOptions | (T[K] extends undefined ? never : T[K]), options?: SetOptions): this; /** * 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 {Parse.Object} Returns the object, so you can chain this call. */ unset>(attr: K, options?: SetOptions): this; /** * 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 {Parse.Object} Returns the object, so you can chain this call. */ increment>(attr: K, amount?: number): this; /** * 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 {Parse.Object} Returns the object, so you can chain this call. */ decrement>(attr: K, amount?: number): this; /** * 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 {Parse.Object} Returns the object, so you can chain this call. */ add[keyof T]>(attr: K, item: NonNullable[number]): this; /** * 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 {Parse.Object} Returns the object, so you can chain this call. */ addAll[keyof T]>(attr: K, items: NonNullable): this; /** * 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 {Parse.Object} Returns the object, so you can chain this call. */ addUnique[keyof T]>(attr: K, item: NonNullable[number]): this; /** * 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 {Parse.Object} Returns the object, so you can chain this call. */ addAllUnique[keyof T]>(attr: K, items: NonNullable): this; /** * 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 {Parse.Object} Returns the object, so you can chain this call. */ remove[keyof T]>(attr: K, item: NonNullable[number]): this; /** * 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 {Parse.Object} Returns the object, so you can chain this call. */ removeAll[keyof T]>(attr: K, items: NonNullable): this; /** * 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: K): Op | undefined; /** * 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(): this; /** * 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: Attributes): ParseError | boolean; /** * Returns the ACL for this object. * * @returns {Parse.ACL|null} 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 {Parse.Object} Returns the object, so you can chain this call. * @see Parse.Object#set */ setACL(acl: ParseACL, options?: any): this; /** * 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: Extract[]): void; /** * Clears all attributes on a model * * @returns {Parse.Object} Returns the object, so you can chain this call. */ clear(): this; /** * 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?: FetchOptions): 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 | (string | string[])[], 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.
     * });
* * Example 2:
     * gameTurn.save("player", "Jake Cutter");
* * @param {string | object | null} [arg1] * Valid options are:
    *
  • `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?: Pick | T | null, arg2?: 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?: DestroyOptions): 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; 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: T[], options?: FetchAllOptions): Promise; /** * 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: T[], keys: keyof T['attributes'] | (keyof T['attributes'])[], options?: RequestOptions): Promise; /** * 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: T[], keys: keyof T['attributes'] | (keyof T['attributes'])[], options?: RequestOptions): Promise; /** * 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 * 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. *
* @static * @returns {Parse.Object[]} */ static fetchAllIfNeeded(list: T[], options?: FetchAllOptions): Promise; static handleIncludeOptions(options: { include?: string | string[]; }): 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 * 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. *
  • transaction: Set to true to enable transactions *
  • batchSize: How many objects to yield in each batch (default: 20) *
* @static * @returns {Promise} A promise that is fulfilled when the destroyAll * completes. */ static destroyAll(list: T[], options?: DestroyAllOptions): 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 * 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. *
  • transaction: Set to true to enable transactions *
  • batchSize: How many objects to yield in each batch (default: 20) *
* @static * @returns {Parse.Object[]} */ static saveAll(list: T, options?: SaveAllOptions): Promise; /** * 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(this: new (...args: any[]) => T, id: string): T; /** * 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): T; /** * 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.

* *

You should call either:

     *     var MyClass = Parse.Object.extend("MyClass", {
     *         Instance methods,
     *         initialize: function(attrs, options) {
     *             this.someInstanceProperty = [],
     *             Other instance properties
     *         }
     *     }, {
     *         Class properties
     *     });
* or, for Backbone compatibility:
     *     var MyClass = Parse.Object.extend({
     *         className: "MyClass",
     *         Instance methods,
     *         initialize: function(attrs, options) {
     *             this.someInstanceProperty = [],
     *             Other instance properties
     *         }
     *     }, {
     *         Class properties
     *     });

* * @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): any; /** * 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: ParseObject[]): 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 Parse.Object.pinAllWithName(name, [obj1, obj2, ...]);
     * 
* * 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: ParseObject[]): 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: ParseObject[]): Promise; /** * Asynchronously removes the objects and every object they point to in the local datastore, recursively. * *
     * await Parse.Object.unPinAllWithName(name, [obj1, obj2, ...]);
     * 
* * @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: ParseObject[]): 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. * *
     * await Parse.Object.unPinAllObjectsWithName(name);
     * 
* * @param {string} name Name of Pin. * @returns {Promise} A promise that is fulfilled when the unPin completes. * @static */ static unPinAllObjectsWithName(name: string): Promise; } export interface ObjectStatic { new (...args: any[]): T; createWithoutData(id: string): T; destroyAll(list: U[], options?: DestroyAllOptions): Promise; extend(className: string | { className: string; }, protoProps?: any, classProps?: any): any; fetchAll(list: U[], options?: FetchAllOptions): Promise; fetchAllIfNeeded(list: U[], options?: FetchAllOptions): Promise; fetchAllIfNeededWithInclude(list: U[], keys: keyof U['attributes'] | (keyof U['attributes'])[], options?: RequestOptions): Promise; fetchAllWithInclude(list: U[], keys: keyof U['attributes'] | (keyof U['attributes'])[], options?: RequestOptions): Promise; fromJSON(json: any, override?: boolean, dirty?: boolean): T; pinAll(objects: ParseObject[]): Promise; pinAllWithName(name: string, objects: ParseObject[]): Promise; registerSubclass(className: string, clazz: new (options?: any) => T): void; saveAll(list: U, options?: SaveAllOptions): Promise; unPinAll(objects: ParseObject[]): Promise; unPinAllObjects(): Promise; unPinAllObjectsWithName(name: string): Promise; unPinAllWithName(name: string, objects: ParseObject[]): Promise; } export interface ObjectConstructor extends ObjectStatic { new (className: string, attributes: T, options?: any): ParseObject; new (className?: string | { className: string; [attr: string]: any; }, attributes?: Attributes, options?: any): ParseObject; } export default ParseObject;