@@ -88,7 +88,7 @@ class Event(_core.CloudEvent[_core.T]):
88
88
_C2 = _typing .Callable [[_E2 ], None ]
89
89
90
90
AuthType = _typing .Literal ["service_account" , "api_key" , "system" ,
91
- "unauthenticated" , "unknown" ]
91
+ "unauthenticated" , "unknown" ]
92
92
93
93
94
94
@_dataclass .dataclass (frozen = True )
@@ -106,10 +106,10 @@ class EventWithAuthContext(Event[_core.T]):
106
106
107
107
108
108
def _firestore_endpoint_handler (
109
- func : _C1 | _C2 | _C3 | _C4 ,
110
- event_type : str ,
111
- document_pattern : _path_pattern .PathPattern ,
112
- raw : _ce .CloudEvent ,
109
+ func : _C1 | _C2 | _C3 | _C4 ,
110
+ event_type : str ,
111
+ document_pattern : _path_pattern .PathPattern ,
112
+ raw : _ce .CloudEvent ,
113
113
) -> None :
114
114
event_attributes = raw ._get_attributes ()
115
115
event_data : _typing .Any = raw .get_data ()
@@ -189,30 +189,29 @@ def _firestore_endpoint_handler(
189
189
** document_pattern .extract_matches (event_document ),
190
190
}
191
191
192
- common_event_kwargs = {
193
- " project" : event_project ,
194
- " namespace" : event_namespace ,
195
- " database" : event_database ,
196
- " location" : event_location ,
197
- " document" : event_document ,
198
- " specversion" : event_attributes ["specversion" ],
199
- "id" : event_attributes ["id" ],
200
- " source" : event_attributes ["source" ],
201
- " type" : event_attributes ["type" ],
202
- " time" : event_time ,
203
- " data" : firestore_event_data ,
204
- " subject" : event_attributes ["subject" ],
205
- " params" : params ,
206
- }
192
+ database_event = Event (
193
+ project = event_project ,
194
+ namespace = event_namespace ,
195
+ database = event_database ,
196
+ location = event_location ,
197
+ document = event_document ,
198
+ specversion = event_attributes ["specversion" ],
199
+ id = event_attributes ["id" ],
200
+ source = event_attributes ["source" ],
201
+ type = event_attributes ["type" ],
202
+ time = event_time ,
203
+ data = firestore_event_data ,
204
+ subject = event_attributes ["subject" ],
205
+ params = params ,
206
+ )
207
207
208
208
if event_type .endswith (".withAuthContext" ):
209
209
database_event_with_auth_context = EventWithAuthContext (
210
- ** common_event_kwargs ,
210
+ ** vars ( database_event ) ,
211
211
auth_type = event_auth_type ,
212
212
auth_id = event_auth_id )
213
213
func (database_event_with_auth_context )
214
214
else :
215
- database_event = Event (** common_event_kwargs )
216
215
# mypy cannot infer that the event type is correct, hence the cast
217
216
_typing .cast (_C1 | _C2 , func )(database_event )
218
217
@@ -267,7 +266,7 @@ def on_document_written_wrapped(raw: _ce.CloudEvent):
267
266
268
267
@_util .copy_func_kwargs (FirestoreOptions )
269
268
def on_document_written_with_auth_context (** kwargs
270
- ) -> _typing .Callable [[_C1 ], _C1 ]:
269
+ ) -> _typing .Callable [[_C1 ], _C1 ]:
271
270
"""
272
271
Event handler that triggers when a document is created, updated, or deleted in Firestore.
273
272
This trigger will also provide the authentication context of the principal who triggered
@@ -366,7 +365,7 @@ def on_document_updated_wrapped(raw: _ce.CloudEvent):
366
365
367
366
@_util .copy_func_kwargs (FirestoreOptions )
368
367
def on_document_updated_with_auth_context (** kwargs
369
- ) -> _typing .Callable [[_C1 ], _C1 ]:
368
+ ) -> _typing .Callable [[_C1 ], _C1 ]:
370
369
"""
371
370
Event handler that triggers when a document is updated in Firestore.
372
371
This trigger will also provide the authentication context of the principal who triggered
@@ -465,7 +464,7 @@ def on_document_created_wrapped(raw: _ce.CloudEvent):
465
464
466
465
@_util .copy_func_kwargs (FirestoreOptions )
467
466
def on_document_created_with_auth_context (** kwargs
468
- ) -> _typing .Callable [[_C2 ], _C2 ]:
467
+ ) -> _typing .Callable [[_C2 ], _C2 ]:
469
468
"""
470
469
Event handler that triggers when a document is created in Firestore.
471
470
This trigger will also provide the authentication context of the principal who triggered
@@ -564,7 +563,7 @@ def on_document_deleted_wrapped(raw: _ce.CloudEvent):
564
563
565
564
@_util .copy_func_kwargs (FirestoreOptions )
566
565
def on_document_deleted_with_auth_context (** kwargs
567
- ) -> _typing .Callable [[_C2 ], _C2 ]:
566
+ ) -> _typing .Callable [[_C2 ], _C2 ]:
568
567
"""
569
568
Event handler that triggers when a document is deleted in Firestore.
570
569
This trigger will also provide the authentication context of the principal who triggered
0 commit comments