From 71efd8066682317a3e4fae7bba8dc5424ec2f936 Mon Sep 17 00:00:00 2001 From: Tyler Stark Date: Tue, 10 May 2022 11:42:54 -0500 Subject: [PATCH] Update docs for pubsub to show `string` for topic + subscription The generated docs show the typing as `PubSubTopic` and `PubSubSubscription`. But to the end user they just need to know its a string. --- src/v2/providers/pubsub.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/v2/providers/pubsub.ts b/src/v2/providers/pubsub.ts index 137d0fd73..bfcd8c699 100644 --- a/src/v2/providers/pubsub.ts +++ b/src/v2/providers/pubsub.ts @@ -12,12 +12,12 @@ import * as options from '../options'; *
  • Messages are listened to via a subscription. *
  • Each subscription listens to the messages published to exactly one topic. */ -export type PubSubTopic = string; +export type Topic = string; /** * Resource that listens to the messages published by exactly one topic. */ -export type PubSubSubscription = string; +export type Subscription = string; /** * Interface representing a Google Cloud Pub/Sub message. @@ -111,13 +111,13 @@ export interface MessagePublishedData { /** Google Cloud Pub/Sub message. */ readonly message: Message; /** A subscription resource. */ - readonly subscription: PubSubSubscription; + readonly subscription: string; } /** PubSubOptions extend EventHandlerOptions but must include a topic. */ export interface PubSubOptions extends options.EventHandlerOptions { /** The Pub/Sub topic to watch for message events */ - topic: PubSubTopic; + topic: string; } /** @@ -127,7 +127,7 @@ export interface PubSubOptions extends options.EventHandlerOptions { * @typeParam T - Type representing `Message.data`'s JSON format */ export function onMessagePublished( - topic: PubSubTopic, + topic: string, handler: (event: CloudEvent>) => any | Promise ): CloudFunction>>; @@ -166,7 +166,7 @@ export function onMessagePublished( const func = (raw: CloudEvent) => { const messagePublishedData = raw.data as { message: unknown; - subscription: PubSubSubscription; + subscription: string; }; messagePublishedData.message = new Message(messagePublishedData.message); return handler(raw as CloudEvent>);