n8n
Version:
n8n Workflow Automation Tool
42 lines (41 loc) • 2.12 kB
TypeScript
import type { ListAgentsQueryDto } from '@n8n/api-types';
import { DataSource, Repository } from '@n8n/typeorm';
import { Agent } from '../entities/agent.entity';
export type AgentSummary = Pick<Agent, 'id' | 'name' | 'projectId' | 'activeVersionId' | 'availableInMCP' | 'updatedAt'>;
export type AgentSummaryFilters = {
query?: string;
publishedOnly?: boolean;
excludeAgentId?: string;
limit?: number;
};
export declare class AgentRepository extends Repository<Agent> {
constructor(dataSource: DataSource);
findByProjectId(projectId: string): Promise<Agent[]>;
findSummariesByProjectIds(projectIds: string[] | null, options?: AgentSummaryFilters): Promise<AgentSummary[]>;
findByProjectIdsPaginated(projectIds: string[] | null, options: ListAgentsQueryDto, { withProject }?: {
withProject?: boolean;
}): Promise<{
count: number;
data: Agent[];
}>;
private applyFilters;
private applySorting;
findByIdAndProjectId(id: string, projectId: string): Promise<Agent | null>;
findById(id: string): Promise<Agent | null>;
findCredentialIndexAgentIdsBatch(afterId: string | null, batchSize: number): Promise<Array<Pick<Agent, 'id'>>>;
findSummariesByIds(ids: string[]): Promise<Array<Pick<Agent, 'id' | 'name' | 'projectId'>>>;
findByIdInProjects(id: string, projectIds: string[]): Promise<Agent | null>;
existsByIdAndProjectId(id: string, projectId: string): Promise<boolean>;
findByIdsAndProjectId(ids: string[], projectId: string): Promise<Array<Pick<Agent, 'id' | 'activeVersionId'>>>;
findMcpAvailabilityCandidates(where: {
ids: string[];
} | {
projectIds: string[];
} | {
all: true;
}): Promise<Array<Pick<Agent, 'id' | 'projectId' | 'availableInMCP'>>>;
setAvailableInMCP(agentIds: string[], availableInMCP: boolean): Promise<void>;
claimSetupCompleted(id: string, completedAt: Date): Promise<boolean>;
findPublished(): Promise<Agent[]>;
findByIntegrationCredential(type: string, credentialId: string, projectId: string, excludeAgentId: string): Promise<Agent[]>;
}