Functions
Function | Description |
---|---|
onDocumentCreated(document, handler) | Event handler that triggers when a document is created in Firestore. |
onDocumentCreated(opts, handler) | Event handler that triggers when a document is created in Firestore. |
onDocumentCreatedWithAuthContext(document, handler) | Event handler that triggers when a document is created in Firestore. This trigger also provides the authentication context of the principal who triggered the event. |
onDocumentCreatedWithAuthContext(opts, handler) | Event handler that triggers when a document is created in Firestore. This trigger also provides the authentication context of the principal who triggered the event. |
onDocumentDeleted(document, handler) | Event handler that triggers when a document is deleted in Firestore. |
onDocumentDeleted(opts, handler) | Event handler that triggers when a document is deleted in Firestore. |
onDocumentDeletedWithAuthContext(document, handler) | Event handler that triggers when a document is deleted in Firestore. This trigger also provides the authentication context of the principal who triggered the event. |
onDocumentDeletedWithAuthContext(opts, handler) | Event handler that triggers when a document is deleted in Firestore. This trigger also provides the authentication context of the principal who triggered the event. |
onDocumentUpdated(document, handler) | Event handler that triggers when a document is updated in Firestore. |
onDocumentUpdated(opts, handler) | Event handler that triggers when a document is updated in Firestore. |
onDocumentUpdatedWithAuthContext(document, handler) | Event handler that triggers when a document is updated in Firestore. This trigger also provides the authentication context of the principal who triggered the event. |
onDocumentUpdatedWithAuthContext(opts, handler) | Event handler that triggers when a document is updated in Firestore. This trigger also provides the authentication context of the principal who triggered the event. |
onDocumentWritten(document, handler) | Event handler that triggers when a document is created, updated, or deleted in Firestore. |
onDocumentWritten(opts, handler) | Event handler that triggers when a document is created, updated, or deleted in Firestore. |
onDocumentWrittenWithAuthContext(document, handler) | Event handler that triggers when a document is created, updated, or deleted in Firestore. This trigger also provides the authentication context of the principal who triggered the event. |
onDocumentWrittenWithAuthContext(opts, handler) | Event handler that triggers when a document is created, updated, or deleted in Firestore. This trigger also provides the authentication context of the principal who triggered the event. |
Classes
Class | Description |
---|---|
Change | The Cloud Functions interface for events that change state, such as Realtime Database or Cloud Firestore onWrite and onUpdate events.For more information about the format used to construct Change objects, see below. |
Interfaces
Interface | Description |
---|---|
DocumentOptions | DocumentOptions extend EventHandlerOptions with provided document and optional database and namespace. |
FirestoreAuthEvent | |
FirestoreEvent | A CloudEvent that contains a DocumentSnapshot or a Change |
Type Aliases
Type Alias | Description |
---|---|
AuthType | AuthType defines the possible values for the authType field in a Firestore event with auth context. - service_account: a non-user principal used to identify a workload or machine user. - api_key: a non-user client API key. - system: an obscured identity used when Cloud Platform or another system triggered the event. Examples include a database record which was deleted based on a TTL. - unauthenticated: an unauthenticated action. - unknown: a general type to capture all other principals not captured in the other auth types. |
DocumentSnapshot | A Firestore DocumentSnapshot |
QueryDocumentSnapshot | A Firestore QueryDocumentSnapshot |
firestore.onDocumentCreated()
Event handler that triggers when a document is created in Firestore.
Signature:
export declare function onDocumentCreated extends string>(document: Document, handler: (event: FirestoreEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf |
Event handler which is run every time a Firestore create occurs. |
Returns:
CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf
firestore.onDocumentCreated()
Event handler that triggers when a document is created in Firestore.
Signature:
export declare function onDocumentCreated extends string>(opts: DocumentOptions , handler: (event: FirestoreEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions |
Options that can be set on an individual event-handling function. |
handler | (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf |
Event handler which is run every time a Firestore create occurs. |
Returns:
CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf
firestore.onDocumentCreatedWithAuthContext()
Event handler that triggers when a document is created in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Signature:
export declare function onDocumentCreatedWithAuthContext extends string>(document: Document, handler: (event: FirestoreAuthEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf |
Event handler which is run every time a Firestore create occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf
firestore.onDocumentCreatedWithAuthContext()
Event handler that triggers when a document is created in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Signature:
export declare function onDocumentCreatedWithAuthContext extends string>(opts: DocumentOptions , handler: (event: FirestoreAuthEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions |
Options that can be set on an individual event-handling function. |
handler | (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf |
Event handler which is run every time a Firestore create occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf
firestore.onDocumentDeleted()
Event handler that triggers when a document is deleted in Firestore.
Signature:
export declare function onDocumentDeleted extends string>(document: Document, handler: (event: FirestoreEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf |
Event handler which is run every time a Firestore delete occurs. |
Returns:
CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf
firestore.onDocumentDeleted()
Event handler that triggers when a document is deleted in Firestore.
Signature:
export declare function onDocumentDeleted extends string>(opts: DocumentOptions , handler: (event: FirestoreEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions |
Options that can be set on an individual event-handling function. |
handler | (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf |
Event handler which is run every time a Firestore delete occurs. |
Returns:
CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf
firestore.onDocumentDeletedWithAuthContext()
Event handler that triggers when a document is deleted in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Signature:
export declare function onDocumentDeletedWithAuthContext extends string>(document: Document, handler: (event: FirestoreAuthEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf |
Event handler which is run every time a Firestore delete occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf
firestore.onDocumentDeletedWithAuthContext()
Event handler that triggers when a document is deleted in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Signature:
export declare function onDocumentDeletedWithAuthContext extends string>(opts: DocumentOptions , handler: (event: FirestoreAuthEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions |
Options that can be set on an individual event-handling function. |
handler | (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf |
Event handler which is run every time a Firestore delete occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf
firestore.onDocumentUpdated()
Event handler that triggers when a document is updated in Firestore.
Signature:
export declare function onDocumentUpdated extends string>(document: Document, handler: (event: FirestoreEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf |
Event handler which is run every time a Firestore update occurs. |
Returns:
CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf
firestore.onDocumentUpdated()
Event handler that triggers when a document is updated in Firestore.
Signature:
export declare function onDocumentUpdated extends string>(opts: DocumentOptions , handler: (event: FirestoreEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions |
Options that can be set on an individual event-handling function. |
handler | (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf |
Event handler which is run every time a Firestore update occurs. |
Returns:
CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf
firestore.onDocumentUpdatedWithAuthContext()
Event handler that triggers when a document is updated in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Signature:
export declare function onDocumentUpdatedWithAuthContext extends string>(document: Document, handler: (event: FirestoreAuthEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf |
Event handler which is run every time a Firestore update occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf
firestore.onDocumentUpdatedWithAuthContext()
Event handler that triggers when a document is updated in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Signature:
export declare function onDocumentUpdatedWithAuthContext extends string>(opts: DocumentOptions , handler: (event: FirestoreAuthEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions |
Options that can be set on an individual event-handling function. |
handler | (event: FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf |
Event handler which is run every time a Firestore update occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf
firestore.onDocumentWritten()
Event handler that triggers when a document is created, updated, or deleted in Firestore.
Signature:
export declare function onDocumentWritten extends string>(document: Document, handler: (event: FirestoreEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf |
Event handler which is run every time a Firestore create, update, or delete occurs. |
Returns:
CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf
firestore.onDocumentWritten()
Event handler that triggers when a document is created, updated, or deleted in Firestore.
Signature:
export declare function onDocumentWritten extends string>(opts: DocumentOptions , handler: (event: FirestoreEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions |
Options that can be set on an individual event-handling function. |
handler | (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf |
Event handler which is run every time a Firestore create, update, or delete occurs. |
Returns:
CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf
firestore.onDocumentWrittenWithAuthContext()
Event handler that triggers when a document is created, updated, or deleted in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Signature:
export declare function onDocumentWrittenWithAuthContext extends string>(document: Document, handler: (event: FirestoreAuthEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf |
Event handler which is run every time a Firestore create, update, or delete occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf
firestore.onDocumentWrittenWithAuthContext()
Event handler that triggers when a document is created, updated, or deleted in Firestore. This trigger also provides the authentication context of the principal who triggered the event.
Signature:
export declare function onDocumentWrittenWithAuthContext extends string>(opts: DocumentOptions , handler: (event: FirestoreAuthEvent | undefined, ParamsOf >) => any | Promise ): CloudFunction | undefined, ParamsOf >>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions |
Options that can be set on an individual event-handling function. |
handler | (event: FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf |
Event handler which is run every time a Firestore create, update, or delete occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf
firestore.AuthType
AuthType defines the possible values for the authType field in a Firestore event with auth context. - service_account: a non-user principal used to identify a workload or machine user. - api_key: a non-user client API key. - system: an obscured identity used when Cloud Platform or another system triggered the event. Examples include a database record which was deleted based on a TTL. - unauthenticated: an unauthenticated action. - unknown: a general type to capture all other principals not captured in the other auth types.
Signature:
export type AuthType = "service_account" | "api_key" | "system" | "unauthenticated" | "unknown";
firestore.DocumentSnapshot
A Firestore DocumentSnapshot
Signature:
export type DocumentSnapshot = firestore.DocumentSnapshot;
firestore.QueryDocumentSnapshot
A Firestore QueryDocumentSnapshot
Signature:
export type QueryDocumentSnapshot = firestore.QueryDocumentSnapshot;