UNPKG

typescript-scaffolder

Version:

![npm version](https://img.shields.io/npm/v/typescript-scaffolder) ### Unit Test Coverage: 97.12%

30 lines 1.46 kB
/** * Creates a registry of webhook functions within a file that can be used at runtime. * This function will produce an object in the following shape, * where the field name equals the folder name where the webhook files are located * * Example: * export const webhookRegistry = { * 'source-charlie': { * ...handle_payment_webhook * }, * 'source-delta': { * ...send_notification_webhook * } * }; * * @param webhookRootDir - the parent directory where the webhook files are located. Will go into child directories * @param registryFileName - the name of the registry file */ export declare function generateWebhookRegistry(webhookRootDir: string, registryFileName?: string): Promise<void>; /** * Dynamically retrieves a webhook function from the generated registry. * * @param webhookRegistry - A nested record of namespace -> function name -> webhook function. * @param service - The top-level key representing a group of webhook handlers (e.g. a source system). * @param functionName - The exported name of the function within the selected service. * @returns The referenced webhook function. * @throws If the function or service cannot be found in the registry. */ export declare function getWebhookFunction(webhookRegistry: Record<string, Record<string, (...args: any[]) => Promise<any>>>, service: string, functionName: string): (...args: any[]) => Promise<any>; //# sourceMappingURL=generate-webhook-registry.d.ts.map