AgentApiModule · library/agent-api/src/agent-api-repo.ts:46

AgentApiRepo

component

No JSDoc comment in source yet.

API

@Component()
export class AgentApiRepo implements AgentApi {
  @Use() private readonly db!: Db;
  get(projectId: string, agentId: string): AgentApiRow | null;
  set(projectId: string, agentId: string, patch: AgentApiPatch, at: string): AgentApiRow;
  enabledAgents(projectId: string): string[];
  listKeys(projectId: string, agentId: string): AgentApiKeyRow[];
  insertKey(row: AgentApiKeyRow & { tokenHash: string }): void;
  findKeyByHash(tokenHash: string): AgentApiKeyRow | null;
  touchKey(keyId: string, at: string): void;
  deleteKey(projectId: string, agentId: string, keyId: string): boolean;
  deleteByAgent(projectId: string, agentId: string): void;
  deleteByProject(projectId: string): void;
}

Dependencies & Wiring

Extracted from class decorators
implementsinterfaces
@Userequires (1)
db: Db

Methods (10)

get

get(projectId: string, agentId: string): AgentApiRow | null
@paramprojectIdstring
@paramagentIdstring
@returnsAgentApiRow | null

set

set(projectId: string, agentId: string, patch: AgentApiPatch, at: string): AgentApiRow
@paramprojectIdstring
@paramagentIdstring
@parampatchAgentApiPatch
@paramatstring
@returnsAgentApiRow

enabledAgents

enabledAgents(projectId: string): string[]
@paramprojectIdstring
@returnsstring[]

listKeys

listKeys(projectId: string, agentId: string): AgentApiKeyRow[]
@paramprojectIdstring
@paramagentIdstring
@returnsAgentApiKeyRow[]

insertKey

insertKey(row: AgentApiKeyRow & { tokenHash: string }): void
@paramrowAgentApiKeyRow & { tokenHash: string }
@returnsvoid

findKeyByHash

findKeyByHash(tokenHash: string): AgentApiKeyRow | null
@paramtokenHashstring
@returnsAgentApiKeyRow | null

touchKey

touchKey(keyId: string, at: string): void
@paramkeyIdstring
@paramatstring
@returnsvoid

deleteKey

deleteKey(projectId: string, agentId: string, keyId: string): boolean
@paramprojectIdstring
@paramagentIdstring
@paramkeyIdstring
@returnsboolean

deleteByAgent

deleteByAgent(projectId: string, agentId: string): void
@paramprojectIdstring
@paramagentIdstring
@returnsvoid

deleteByProject

deleteByProject(projectId: string): void
@paramprojectIdstring
@returnsvoid