@@ -54,17 +54,127 @@ export type AlertType =
5454export interface FirebaseAlertOptions extends options . EventHandlerOptions {
5555 /** Scope the handler to trigger on an alert type. */
5656 alertType : AlertType ;
57+
5758 /** Scope the function to trigger on a specific application. */
5859 appId ?: string ;
60+
61+ /**
62+ * Region where functions should be deployed.
63+ */
64+ region ?: options . SupportedRegion | string ;
65+
66+ /**
67+ * Amount of memory to allocate to a function.
68+ * A value of null restores the defaults of 256MB.
69+ */
70+ memory ?: options . MemoryOption | null ;
71+
72+ /**
73+ * Timeout for the function in sections, possible values are 0 to 540.
74+ * HTTPS functions can specify a higher timeout.
75+ * A value of null restores the default of 60s
76+ * The minimum timeout for a gen 2 function is 1s. The maximum timeout for a
77+ * function depends on the type of function: Event handling functions have a
78+ * maximum timeout of 540s (9 minutes). HTTPS and callable functions have a
79+ * maximum timeout of 36,00s (1 hour). Task queue functions have a maximum
80+ * timeout of 1,800s (30 minutes)
81+ */
82+ timeoutSeconds ?: number | null ;
83+
84+ /**
85+ * Min number of actual instances to be running at a given time.
86+ * Instances will be billed for memory allocation and 10% of CPU allocation
87+ * while idle.
88+ * A value of null restores the default min instances.
89+ */
90+ minInstances ?: number | null ;
91+
92+ /**
93+ * Max number of instances to be running in parallel.
94+ * A value of null restores the default max instances.
95+ */
96+ maxInstances ?: number | null ;
97+
98+ /**
99+ * Number of requests a function can serve at once.
100+ * Can only be applied to functions running on Cloud Functions v2.
101+ * A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise).
102+ * Concurrency cannot be set to any value other than 1 if `cpu` is less than 1.
103+ * The maximum value for concurrency is 1,000.
104+ */
105+ concurrency ?: number | null ;
106+
107+ /**
108+ * Fractional number of CPUs to allocate to a function.
109+ * Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes.
110+ * This is different from the defaults when using the gcloud utility and is different from
111+ * the fixed amount assigned in Google Cloud Functions generation 1.
112+ * To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this
113+ * to the value "gcf_gen1"
114+ */
115+ cpu ?: number | 'gcf_gen1' ;
116+
117+ /**
118+ * Connect cloud function to specified VPC connector.
119+ * A value of null removes the VPC connector
120+ */
121+ vpcConnector ?: string | null ;
122+
123+ /**
124+ * Egress settings for VPC connector.
125+ * A value of null turns off VPC connector egress settings
126+ */
127+ vpcConnectorEgressSettings ?: options . VpcEgressSetting | null ;
128+
129+ /**
130+ * Specific service account for the function to run as.
131+ * A value of null restores the default service account.
132+ */
133+ serviceAccount ?: string | null ;
134+
135+ /**
136+ * Ingress settings which control where this function can be called from.
137+ * A value of null turns off ingress settings.
138+ */
139+ ingressSettings ?: options . IngressSetting | null ;
140+
141+ /**
142+ * User labels to set on the function.
143+ */
144+ labels ?: Record < string , string > ;
145+
146+ /*
147+ * Secrets to bind to a function.
148+ */
149+ secrets ?: string [ ] ;
150+
151+ /** Whether failed executions should be delivered again. */
152+ retry ?: boolean ;
59153}
60154
61155/**
62156 * Declares a function that can handle Firebase Alerts from CloudEvents.
63- * @typeParam T - The data type of the `FirebaseAlertData` object the function receives .
64- * @param alertTypeOrOpts the alert type or Firebase Alert function configuration.
157+ * @typeParam T - the type of event.data.payload .
158+ * @param alertType - the alert type or Firebase Alert function configuration.
65159 * @param handler a function that can handle the Firebase Alert inside a CloudEvent.
66160 * @returns A function that you can export and deploy.
67161 */
162+ export function onAlertPublished < T extends { [ '@type' ] : string } = any > (
163+ alertType : AlertType ,
164+ handler : ( event : AlertEvent < T > ) => any | Promise < any >
165+ ) : CloudFunction < AlertEvent < T > > ;
166+
167+ /**
168+ * Declares a function that can handle Firebase Alerts from CloudEvents.
169+ * @typeParam T - the type of event.data.payload.
170+ * @param options - the alert type and other options for this cloud function.
171+ * @param handler a function that can handle the Firebase Alert inside a CloudEvent.
172+ */
173+ export function onAlertPublished < T extends { [ '@type' ] : string } = any > (
174+ options : FirebaseAlertOptions ,
175+ handler : ( event : AlertEvent < T > ) => any | Promise < any >
176+ ) : CloudFunction < AlertEvent < T > > ;
177+
68178export function onAlertPublished < T extends { [ '@type' ] : string } = any > (
69179 alertTypeOrOpts : AlertType | FirebaseAlertOptions ,
70180 handler : ( event : AlertEvent < T > ) => any | Promise < any >
0 commit comments