import type { TelemetryCallbacks } from "./function-utils"; import type { EventEmissionContext } from "../plugins/eventEmission"; /** * Creates a standardized telemetry callback for SDK method invocations. * * This factory eliminates boilerplate by providing a consistent implementation * of the onMethodCalled callback used by createFunction and createPaginatedFunction. * * @param emitMethodCalled - The event emission function from EventEmissionContext * @param methodName - The method name to report in telemetry. Use `function.name` to derive * this automatically from the function declaration, ensuring DRY principles and making * refactoring easier. Function names are preserved through bundling. * @returns TelemetryCallbacks object with standardized onMethodCalled implementation * * @example * Basic usage with createFunction: * ```typescript * async function listApps(options: ListAppsOptions) { ... } * * const listAppsDefinition = createFunction( * listApps, * ListAppsSchema, * createTelemetryCallback(context.eventEmission.emitMethodCalled, listApps.name), * ); * ``` * * @example * For paginated functions, use stripPageSuffix to remove the "Page" suffix: * ```typescript * import { stripPageSuffix } from "./string-utils"; * * async function listAppsPage(options: ListAppsOptions & { pageSize: number }) { ... } * * const methodName = stripPageSuffix(listAppsPage.name); * const listAppsDefinition = createPaginatedFunction( * listAppsPage, * ListAppsSchema, * createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), * methodName, * ); * ``` */ export declare function createTelemetryCallback(emitMethodCalled: EventEmissionContext["eventEmission"]["emitMethodCalled"], methodName: string): TelemetryCallbacks; //# sourceMappingURL=telemetry-utils.d.ts.map