UNPKG

1.32 kBTypeScriptView Raw
1/**
2 * `ChangeJson` is the JSON format used to construct a `Change` object.
3 */
4export interface ChangeJson {
5 /**
6 * Key-value pairs representing state of data after the change.
7 */
8 after?: any;
9 /**
10 * Key-value pairs representing state of data before the change. If
11 * `fieldMask` is set, then only fields that changed are present in `before`.
12 */
13 before?: any;
14 /**
15 * Comma-separated string that represents names of fields that changed.
16 */
17 fieldMask?: string;
18}
19/**
20 * The Cloud Functions interface for events that change state, such as
21 * Realtime Database or Cloud Firestore `onWrite` and `onUpdate` events.
22 *
23 * For more information about the format used to construct `Change` objects, see
24 * {@link ChangeJson} below.
25 *
26 */
27export declare class Change<T> {
28 before: T;
29 after: T;
30 /**
31 * Factory method for creating a `Change` from a `before` object and an `after`
32 * object.
33 */
34 static fromObjects<T>(before: T, after: T): Change<T>;
35 /**
36 * Factory method for creating a `Change` from JSON and an optional customizer
37 * function to be applied to both the `before` and the `after` fields.
38 */
39 static fromJSON<T>(json: ChangeJson, customizer?: (x: any) => T): Change<T>;
40 constructor(before: T, after: T);
41}
42
\No newline at end of file