@convex-dev/workflow
Version:
Convex component for durably executing workflows.
21 lines (19 loc) • 517 B
text/typescript
import {
type FunctionReference,
type FunctionType,
type FunctionVisibility,
getFunctionAddress,
getFunctionName,
} from "convex/server";
export function safeFunctionName(
f: FunctionReference<FunctionType, FunctionVisibility>,
) {
const address = getFunctionAddress(f);
return (
address.name ||
(address.reference && address.reference.split("/").slice(2).join("/")) ||
(address.functionHandle &&
address.functionHandle.slice("function://".length)) ||
getFunctionName(f)
);
}