@@ -63,8 +63,19 @@ export interface RawRTDBCloudEvent extends CloudEvent<RawRTDBCloudEventData> {
6363 instance : string ;
6464 ref : string ;
6565 location : string ;
66+ authtype : AuthType ;
67+ authid ?: string ;
6668}
6769
70+ /**
71+ * AuthType defines the possible values for the authType field in a Realtime Database event.
72+ * - app_user: an end user of an application..
73+ * - admin: an admin user of an application. In the context of impersonate endpoints used by the admin SDK, the impersonator.
74+ * - unauthenticated: no credentials were used to authenticate the change that triggered the occurrence.
75+ * - unknown: a general type to capture all other principals not captured in the other auth types.
76+ */
77+ export type AuthType = "app_user" | "admin" | "unauthenticated" | "unknown" ;
78+
6879/** A CloudEvent that contains a DataSnapshot or a Change<DataSnapshot> */
6980export interface DatabaseEvent < T , Params = Record < string , string > > extends CloudEvent < T > {
7081 /** The domain of the database instance */
@@ -83,11 +94,11 @@ export interface DatabaseEvent<T, Params = Record<string, string>> extends Cloud
8394 /**
8495 * The type of principal that triggered the event.
8596 */
86- authType ?: "app_user" | "admin" | "unauthenticated" ;
97+ authtype : AuthType
8798 /**
8899 * The unique identifier of the principal.
89100 */
90- authId ?: string ;
101+ authid ?: string ;
91102}
92103
93104/** ReferenceOptions extend EventHandlerOptions with provided ref and optional instance */
@@ -392,6 +403,8 @@ function makeDatabaseEvent<Params>(
392403 firebaseDatabaseHost : event . firebasedatabasehost ,
393404 data : snapshot ,
394405 params,
406+ authtype : event . authtype ,
407+ authid : event . authid
395408 } ;
396409 delete ( databaseEvent as any ) . firebasedatabasehost ;
397410 return databaseEvent ;
0 commit comments