@@ -28,7 +28,7 @@ import * as options from '../options';
2828/** Options that can be set on an Eventarc trigger. */
2929export interface EventarcTriggerOptions extends options . EventHandlerOptions {
3030 /**
31- * Type of the event.
31+ * Type of the event to trigger on .
3232 */
3333 eventType : string ;
3434
@@ -54,14 +54,26 @@ export interface EventarcTriggerOptions extends options.EventHandlerOptions {
5454 filters ?: Record < string , string > ;
5555}
5656
57+ /**
58+ * A function that takes a {@link CloudEvent}.
59+ */
5760export type CloudEventHandler = ( event : CloudEvent < any > ) => any | Promise < any > ;
5861
59- /** Handle an Eventarc event published on the default channel. */
62+ /** Handles an Eventarc event published on the default channel.
63+ * @param eventType - Type of the event to trigger on.
64+ * @param handler - A function to execute when triggered.
65+ * @returns A function that you can export and deploy.
66+ */
6067export function onCustomEventPublished < T = any > (
6168 eventType : string ,
6269 handler : CloudEventHandler
6370) : CloudFunction < CloudEvent < T > > ;
6471
72+ /** Handles an Eventarc event.
73+ * @param opts - Options to set on this function
74+ * @param handler - A function to execute when triggered.
75+ * @returns A function that you can export and deploy.
76+ */
6577export function onCustomEventPublished < T = any > (
6678 opts : EventarcTriggerOptions ,
6779 handler : CloudEventHandler
0 commit comments