47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
/**
|
|
* `ChangeJson` is the JSON format used to construct a Change object.
|
|
*/
|
|
export interface ChangeJson {
|
|
/**
|
|
* Key-value pairs representing state of data after the change.
|
|
*/
|
|
after?: any;
|
|
/**
|
|
* Key-value pairs representing state of data before the change. If
|
|
* `fieldMask` is set, then only fields that changed are present in `before`.
|
|
*/
|
|
before?: any;
|
|
/**
|
|
* @hidden
|
|
* Comma-separated string that represents names of fields that changed.
|
|
*/
|
|
fieldMask?: string;
|
|
}
|
|
/** @hidden */
|
|
export declare function applyFieldMask(sparseBefore: any, after: any, fieldMask: string): any;
|
|
/**
|
|
* The Functions interface for events that change state, such as
|
|
* Realtime Database or Cloud Firestore `onWrite` and `onUpdate`.
|
|
*
|
|
* For more information about the format used to construct `Change` objects, see
|
|
* {@link ChangeJson} below.
|
|
*
|
|
*/
|
|
export declare class Change<T> {
|
|
before: T;
|
|
after: T;
|
|
/**
|
|
* @hidden
|
|
* Factory method for creating a Change from a `before` object and an `after`
|
|
* object.
|
|
*/
|
|
static fromObjects<T>(before: T, after: T): Change<T>;
|
|
/**
|
|
* @hidden
|
|
* Factory method for creating a Change from a JSON and an optional customizer
|
|
* function to be applied to both the `before` and the `after` fields.
|
|
*/
|
|
static fromJSON<T>(json: ChangeJson, customizer?: (x: any) => T): Change<T>;
|
|
constructor(before: T, after: T);
|
|
}
|