Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docgen/content-sources/toc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ toc:
path: /docs/reference/functions/function_builder_.functionbuilder.html
- title: 'Change'
path: /docs/reference/functions/cloud_functions_.change.html
- title: 'ChangeJson'
path: /docs/reference/functions/cloud_functions_.changejson.html

- title: 'functions.config'
path: /docs/reference/functions/config_.html
Expand Down
16 changes: 12 additions & 4 deletions src/cloud-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,19 @@ export interface EventContext {
}

/**
* Change describes a change of state - "before" represents the state prior to
* the event, "after" represents the state after the event.
* 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
* [`cloud-functions.ChangeJson`](/docs/reference/functions/cloud_functions_.changejson).
*
*/
export class Change<T> {
constructor(public before: T, public after: T) {}
}

/**
* ChangeJson is the JSON format used to construct a Change object.
* `ChangeJson` is the JSON format used to construct a Change object.
*/
export interface ChangeJson {
/**
Expand All @@ -164,17 +168,20 @@ export interface ChangeJson {
*/
before?: any;
/**
* Comma-separated string that represents names of field that changed.
* @hidden
* Comma-separated string that represents names of fields that changed.
*/
fieldMask?: string;
}

export namespace Change {
/** @hidden */
function reinterpretCast<T>(x: any) {
return x as T;
}

/**
* @hidden
* Factory method for creating a Change from a `before` object and an `after`
* object.
*/
Expand All @@ -183,6 +190,7 @@ export namespace Change {
}

/**
* @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.
*/
Expand Down