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<Document extends string>(document: Document, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore create occurs. |
Returns:
CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>
firestore.onDocumentCreated()
Event handler that triggers when a document is created in Firestore.
Signature:
export declare function onDocumentCreated<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions<Document> | Options that can be set on an individual event-handling function. |
handler | (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore create occurs. |
Returns:
CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>
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<Document extends string>(document: Document, handler: (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore create occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>
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<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions<Document> | Options that can be set on an individual event-handling function. |
handler | (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore create occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>
firestore.onDocumentDeleted()
Event handler that triggers when a document is deleted in Firestore.
Signature:
export declare function onDocumentDeleted<Document extends string>(document: Document, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore delete occurs. |
Returns:
CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>
firestore.onDocumentDeleted()
Event handler that triggers when a document is deleted in Firestore.
Signature:
export declare function onDocumentDeleted<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions<Document> | Options that can be set on an individual event-handling function. |
handler | (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore delete occurs. |
Returns:
CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>
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<Document extends string>(document: Document, handler: (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore delete occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>
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<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions<Document> | Options that can be set on an individual event-handling function. |
handler | (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore delete occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>
firestore.onDocumentUpdated()
Event handler that triggers when a document is updated in Firestore.
Signature:
export declare function onDocumentUpdated<Document extends string>(document: Document, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore update occurs. |
Returns:
CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>
firestore.onDocumentUpdated()
Event handler that triggers when a document is updated in Firestore.
Signature:
export declare function onDocumentUpdated<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions<Document> | Options that can be set on an individual event-handling function. |
handler | (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore update occurs. |
Returns:
CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>
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<Document extends string>(document: Document, handler: (event: FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore update occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>
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<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions<Document> | Options that can be set on an individual event-handling function. |
handler | (event: FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore update occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>
firestore.onDocumentWritten()
Event handler that triggers when a document is created, updated, or deleted in Firestore.
Signature:
export declare function onDocumentWritten<Document extends string>(document: Document, handler: (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore create, update, or delete occurs. |
Returns:
CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>
firestore.onDocumentWritten()
Event handler that triggers when a document is created, updated, or deleted in Firestore.
Signature:
export declare function onDocumentWritten<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions<Document> | Options that can be set on an individual event-handling function. |
handler | (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore create, update, or delete occurs. |
Returns:
CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>
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<Document extends string>(document: Document, handler: (event: FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The Firestore document path to trigger on. |
handler | (event: FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore create, update, or delete occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>
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<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | DocumentOptions<Document> | Options that can be set on an individual event-handling function. |
handler | (event: FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any> | Event handler which is run every time a Firestore create, update, or delete occurs. |
Returns:
CloudFunction<FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>
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;