UNPKG

typed-tasks

Version:

A type-safe abstraction for Google Cloud Tasks

19 lines 1.02 kB
import { z } from "zod"; import type { SchemaRecord, TaskHandlerOptions } from "./types"; /** * Creates a factory function for generating type-safe task handlers * * @param schemas - Extracted schemas from task definitions * @param region - GCP region * @param globalOptions - Default options for all handlers * @param taskRegistry - Registry to store task configurations that need to be * shared with the scheduler * @returns A factory function for creating handlers that returns an object with * the queueName as the property name and the handler function as the value */ export declare function createTaskHandlerFactory<Schemas extends SchemaRecord>(schemas: Schemas, region: string, globalOptions?: TaskHandlerOptions): <T extends keyof Schemas & string>({ queueName, options, handler, }: { queueName: T; options?: TaskHandlerOptions; handler: (payload: z.infer<Schemas[T]>) => Promise<void>; }) => import("firebase-functions/tasks").TaskQueueFunction<any>; //# sourceMappingURL=handler.d.ts.map