UNPKG

@codecompose/typed-pubsub

Version:

A type-safe pub/sub abstraction for Google Cloud and Firebase

21 lines 1.01 kB
import type { PubSub } from "@google-cloud/pubsub"; import { onMessagePublished as firebaseOnMessagePublished } from "firebase-functions/v2/pubsub"; import type { SchemaRecord, TypedPubsubClient, TypedPubsubOptions } from "./types"; /** * Creates a type-safe Pubsub client for handling messages with schema * validation * * @param pubsubClient - Google Cloud Pubsub client instance * @param schemas - Zod schemas for validating messages for each topic * @param region - GCP region for the Pubsub functions * @param options - Global defaults for all handlers * @returns Type-safe Pubsub client with publisher and handler factories */ export declare function createTypedPubsub<Schemas extends SchemaRecord<string>>({ client, schemas, region, options, onMessagePublished, }: { client: PubSub; schemas: Schemas; region: string; options?: TypedPubsubOptions; onMessagePublished?: typeof firebaseOnMessagePublished; }): TypedPubsubClient<Schemas>; //# sourceMappingURL=factory.d.ts.map