2020// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121// SOFTWARE.
2222
23+ /**
24+ * Cloud functions to integrate directly with Eventarc.
25+ * @packageDocumentation
26+ */
27+
2328import { convertIfPresent , copyIfPresent } from '../../common/encoding' ;
2429import { ManifestEndpoint } from '../../runtime/manifest' ;
2530import { CloudEvent , CloudFunction } from '../core' ;
@@ -147,19 +152,14 @@ export interface EventarcTriggerOptions extends options.EventHandlerOptions {
147152 retry ?: boolean ;
148153}
149154
150- /**
151- * A function that takes a {@link CloudEvent}.
152- */
153- export type CloudEventHandler = ( event : CloudEvent < any > ) => any | Promise < any > ;
154-
155155/** Handles an Eventarc event published on the default channel.
156156 * @param eventType - Type of the event to trigger on.
157157 * @param handler - A function to execute when triggered.
158158 * @returns A function that you can export and deploy.
159159 */
160160export function onCustomEventPublished < T = any > (
161161 eventType : string ,
162- handler : CloudEventHandler
162+ handler : ( event : CloudEvent < T > ) => any | Promise < any >
163163) : CloudFunction < CloudEvent < T > > ;
164164
165165/** Handles an Eventarc event.
@@ -169,12 +169,12 @@ export function onCustomEventPublished<T = any>(
169169 */
170170export function onCustomEventPublished < T = any > (
171171 opts : EventarcTriggerOptions ,
172- handler : CloudEventHandler
172+ handler : ( event : CloudEvent < T > ) => any | Promise < any >
173173) : CloudFunction < CloudEvent < T > > ;
174174
175175export function onCustomEventPublished < T = any > (
176176 eventTypeOrOpts : string | EventarcTriggerOptions ,
177- handler : CloudEventHandler
177+ handler : ( event : CloudEvent < T > ) => any | Promise < any >
178178) : CloudFunction < CloudEvent < T > > {
179179 let opts : EventarcTriggerOptions ;
180180 if ( typeof eventTypeOrOpts === 'string' ) {
0 commit comments