Skip to content

Commit

Permalink
feat: add list method to AgentTester (#35)
Browse files Browse the repository at this point in the history
* feat: add list method to AgentTester

* chore: update types
  • Loading branch information
mdonnalley authored Jan 24, 2025
1 parent 423d4a1 commit 2703724
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/agentTester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { Connection, Lifecycle, PollingClient, StatusResult } from '@salesforce/core';
import { Duration, env } from '@salesforce/kit';
import ansis from 'ansis';
import { FileProperties } from '@salesforce/source-deploy-retrieve';
import { MaybeMock } from './maybe-mock';

export type TestStatus = 'New' | 'InProgress' | 'Completed' | 'Error';
Expand Down Expand Up @@ -64,15 +65,24 @@ export type AgentTestResultsResponse = {
};
};

export type AvailableDefinition = Omit<FileProperties, 'manageableState' | 'namespacePrefix'>;

/**
* AgentTester class to test Agents
*/
export class AgentTester {
private maybeMock: MaybeMock;
public constructor(connection: Connection) {
public constructor(private connection: Connection) {
this.maybeMock = new MaybeMock(connection);
}

/**
* List the AiEvaluationDefinitions available in the org.
*/
public async list(): Promise<AvailableDefinition[]> {
return this.connection.metadata.list({ type: 'AiEvaluationDefinition' });
}

/**
* Starts an AI evaluation run based on the provided name or ID.
*
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export { Agent, AgentCreateLifecycleStages, AgentCreateLifecycleStagesV2 } from
export {
AgentTester,
convertTestResultsToFormat,
type AvailableDefinition,
type AgentTestResultsResponse,
type AgentTestStartResponse,
type AgentTestStatusResponse,
Expand Down

0 comments on commit 2703724

Please sign in to comment.