docs: add JSDoc to service public methods

One-line JSDoc on 82 methods across 11 service files for quick
scanning without reading full implementations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
syntaxbullet
2026-04-02 11:36:18 +02:00
parent 5f8819bb46
commit 5bd390b4ee
11 changed files with 82 additions and 10 deletions

View File

@@ -101,10 +101,12 @@ export const tradeService = {
return session;
},
/** Get an active trade session by thread ID. */
getSession: (threadId: string): TradeSession | undefined => {
return sessions.get(threadId);
},
/** Remove a trade session from memory. */
endSession: (threadId: string) => {
sessions.delete(threadId);
},
@@ -126,6 +128,7 @@ export const tradeService = {
session.lastInteraction = Date.now();
},
/** Add an item to a participant's trade offer; unlocks both sides when the offer changes. */
addItem: (threadId: string, userId: string, item: { id: number, name: string }, quantity: bigint) => {
const session = tradeService.getSession(threadId);
if (!session) throw new UserError("Session not found");
@@ -145,6 +148,7 @@ export const tradeService = {
session.lastInteraction = Date.now();
},
/** Remove an item from a participant's trade offer; unlocks both sides. */
removeItem: (threadId: string, userId: string, itemId: number) => {
const session = tradeService.getSession(threadId);
if (!session) throw new UserError("Session not found");
@@ -158,6 +162,7 @@ export const tradeService = {
session.lastInteraction = Date.now();
},
/** Toggle a participant's lock status on their offer; returns the new lock state. */
toggleLock: (threadId: string, userId: string): boolean => {
const session = tradeService.getSession(threadId);
if (!session) throw new UserError("Session not found");
@@ -199,6 +204,7 @@ export const tradeService = {
tradeService.endSession(threadId);
},
/** Clear all active trade sessions from memory. */
clearSessions: () => {
sessions.clear();
console.log("[TradeService] All active trade sessions cleared.");