typescript-scaffolder
Version:
 ### Unit Test Coverage: 97.12%
34 lines • 1.59 kB
TypeScript
/**
* Creates a registry of 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 api files are
* located
*
* Example:
* export const apiRegistry = {
* 'source-charlie': {
* ...person_api
* },
* 'source-delta': {
* ...user_api
* }
* };
*
* @param apiRootDir - the parent directory where the Api files are located. Will go into child directories
* @param registryFileName - the name of the registry file
*/
export declare function generateApiRegistry(apiRootDir: string, registryFileName?: string): Promise<void>;
/**
* Dynamically retrieves an API function from the generated registry.
*
* Note: The returned function's argument signature must be known by the caller.
* This function does not enforce parameter validation or ordering.
* It is the caller's responsibility to pass the correct arguments.
*
* @param apiRegistry - A nested record of service -> function name -> API function.
* @param service - The top-level key representing a group of API clients (e.g. a namespace).
* @param functionName - The exported name of the function within the selected service.
* @returns The referenced API function.
* @throws If the function or service cannot be found in the registry.
*/
export declare function getApiFunction(apiRegistry: Record<string, Record<string, (...args: any[]) => Promise<any>>>, service: string, functionName: string): (...args: any[]) => Promise<any>;
//# sourceMappingURL=generate-api-client-registry.d.ts.map