style: apply prettier formatting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gavrielc
2026-04-15 00:04:11 +03:00
parent c60a9bef2d
commit 4d562524cd
5 changed files with 10 additions and 20 deletions

View File

@@ -12,9 +12,7 @@ export function addMember(row: AgentGroupMember): void {
} }
export function removeMember(userId: string, agentGroupId: string): void { export function removeMember(userId: string, agentGroupId: string): void {
getDb() getDb().prepare('DELETE FROM agent_group_members WHERE user_id = ? AND agent_group_id = ?').run(userId, agentGroupId);
.prepare('DELETE FROM agent_group_members WHERE user_id = ? AND agent_group_id = ?')
.run(userId, agentGroupId);
} }
export function getMembers(agentGroupId: string): AgentGroupMember[] { export function getMembers(agentGroupId: string): AgentGroupMember[] {

View File

@@ -269,7 +269,9 @@ describe('messaging group agents', () => {
}); });
createMessagingGroupAgent({ ...mga(), id: 'mga-2', messaging_group_id: 'mg-2' }); createMessagingGroupAgent({ ...mga(), id: 'mga-2', messaging_group_id: 'mg-2' });
const dests = getDestinations('ag-1').map((d) => d.local_name).sort(); const dests = getDestinations('ag-1')
.map((d) => d.local_name)
.sort();
expect(dests).toEqual(['gen', 'gen-2']); expect(dests).toEqual(['gen', 'gen-2']);
}); });
}); });

View File

@@ -14,9 +14,9 @@ export function upsertUserDm(row: UserDm): void {
} }
export function getUserDm(userId: string, channelType: string): UserDm | undefined { export function getUserDm(userId: string, channelType: string): UserDm | undefined {
return getDb() return getDb().prepare('SELECT * FROM user_dms WHERE user_id = ? AND channel_type = ?').get(userId, channelType) as
.prepare('SELECT * FROM user_dms WHERE user_id = ? AND channel_type = ?') | UserDm
.get(userId, channelType) as UserDm | undefined; | undefined;
} }
export function getUserDmsForUser(userId: string): UserDm[] { export function getUserDmsForUser(userId: string): UserDm[] {

View File

@@ -19,12 +19,7 @@ import {
getSession, getSession,
createPendingApproval, createPendingApproval,
} from './db/sessions.js'; } from './db/sessions.js';
import { import { getAgentGroup, createAgentGroup, updateAgentGroup, getAgentGroupByFolder } from './db/agent-groups.js';
getAgentGroup,
createAgentGroup,
updateAgentGroup,
getAgentGroupByFolder,
} from './db/agent-groups.js';
import { createDestination, getDestinationByName, hasDestination, normalizeName } from './db/agent-destinations.js'; import { createDestination, getDestinationByName, hasDestination, normalizeName } from './db/agent-destinations.js';
import { getMessagingGroup, getMessagingGroupByPlatform } from './db/messaging-groups.js'; import { getMessagingGroup, getMessagingGroupByPlatform } from './db/messaging-groups.js';
import { pickApprovalDelivery, pickApprover } from './access.js'; import { pickApprovalDelivery, pickApprover } from './access.js';
@@ -382,9 +377,7 @@ async function deliverMessage(
if (msg.channel_type && msg.platform_id) { if (msg.channel_type && msg.platform_id) {
const mg = getMessagingGroupByPlatform(msg.channel_type, msg.platform_id); const mg = getMessagingGroupByPlatform(msg.channel_type, msg.platform_id);
if (!mg) { if (!mg) {
throw new Error( throw new Error(`unknown messaging group for ${msg.channel_type}/${msg.platform_id} (message ${msg.id})`);
`unknown messaging group for ${msg.channel_type}/${msg.platform_id} (message ${msg.id})`,
);
} }
const isOriginChat = session.messaging_group_id === mg.id; const isOriginChat = session.messaging_group_id === mg.id;
if (!isOriginChat && !hasDestination(session.agent_group_id, 'channel', mg.id)) { if (!isOriginChat && !hasDestination(session.agent_group_id, 'channel', mg.id)) {

View File

@@ -208,10 +208,7 @@ function extractAndUpsertUser(event: InboundEvent): string | null {
return userId; return userId;
} }
function enforceAccess( function enforceAccess(userId: string | null, agentGroupId: string): { allowed: boolean; reason: string } {
userId: string | null,
agentGroupId: string,
): { allowed: boolean; reason: string } {
if (!userId) return { allowed: false, reason: 'unknown_user' }; if (!userId) return { allowed: false, reason: 'unknown_user' };
const decision = canAccessAgentGroup(userId, agentGroupId); const decision = canAccessAgentGroup(userId, agentGroupId);
if (decision.allowed) return { allowed: true, reason: decision.reason }; if (decision.allowed) return { allowed: true, reason: decision.reason };