import { getSession } from "../lib/neo4j.js";
export async function keyDeregister(params) {
    const { teamName, accountId } = params;
    const session = getSession();
    try {
        const result = await session.run(`MATCH (k:LoopTeamKey {teamName: $teamName, accountId: $accountId})
       DELETE k
       RETURN count(k) AS deleted`, { teamName, accountId });
        const deleted = result.records[0]?.get("deleted")?.toNumber?.() ?? 0;
        if (deleted === 0) {
            throw new Error(`Team "${teamName}" not found.`);
        }
    }
    finally {
        await session.close();
    }
    console.error(`[loop] key-deregister team=${teamName} account=${accountId}`);
}
//# sourceMappingURL=key-deregister.js.map