@@ -12,12 +12,12 @@ import * as options from '../options';
1212 * <li>Messages are listened to via a subscription.
1313 * <li>Each subscription listens to the messages published to exactly one topic.
1414 */
15- export type PubSubTopic = string ;
15+ export type Topic = string ;
1616
1717/**
1818 * Resource that listens to the messages published by exactly one topic.
1919 */
20- export type PubSubSubscription = string ;
20+ export type Subscription = string ;
2121
2222/**
2323 * Interface representing a Google Cloud Pub/Sub message.
@@ -111,13 +111,13 @@ export interface MessagePublishedData<T = any> {
111111 /** Google Cloud Pub/Sub message. */
112112 readonly message : Message < T > ;
113113 /** A subscription resource. */
114- readonly subscription : PubSubSubscription ;
114+ readonly subscription : string ;
115115}
116116
117117/** PubSubOptions extend EventHandlerOptions but must include a topic. */
118118export interface PubSubOptions extends options . EventHandlerOptions {
119119 /** The Pub/Sub topic to watch for message events */
120- topic : PubSubTopic ;
120+ topic : string ;
121121}
122122
123123/**
@@ -127,7 +127,7 @@ export interface PubSubOptions extends options.EventHandlerOptions {
127127 * @typeParam T - Type representing `Message.data`'s JSON format
128128 */
129129export function onMessagePublished < T = any > (
130- topic : PubSubTopic ,
130+ topic : string ,
131131 handler : ( event : CloudEvent < MessagePublishedData < T > > ) => any | Promise < any >
132132) : CloudFunction < CloudEvent < MessagePublishedData < T > > > ;
133133
@@ -166,7 +166,7 @@ export function onMessagePublished<T = any>(
166166 const func = ( raw : CloudEvent < unknown > ) => {
167167 const messagePublishedData = raw . data as {
168168 message : unknown ;
169- subscription : PubSubSubscription ;
169+ subscription : string ;
170170 } ;
171171 messagePublishedData . message = new Message ( messagePublishedData . message ) ;
172172 return handler ( raw as CloudEvent < MessagePublishedData < T > > ) ;
0 commit comments