UNPKG

@memberjunction/a2aserver

Version:

MemberJunction Agent-To-Agent (A2A) Server Implementation

95 lines 3.81 kB
import { BaseEntity, EntityInfo, IMetadataProvider } from "@memberjunction/core"; export interface OperationResult { success: boolean; result?: any; errorMessage?: string; } export interface OperationParameters { [key: string]: any; } export declare class EntityOperations { private contextUser; /** The metadata provider used for all entity operations on this instance. */ private provider; /** * @param provider The per-request `IMetadataProvider` to bind every entity operation to. * The A2A server resolves this once per request (currently from the global * `Metadata.Provider`) and passes it down — when A2AServer gains an `AppContext`-style * per-request provider model, only the server's request handler changes; this class is * already correct. */ constructor(provider: IMetadataProvider); /** * Finds an entity by name * @param entityName The entity name to find * @returns The entity info or null if not found */ findEntity(entityName: string): EntityInfo | null; /** * Converts an entity object to JSON * @param record The entity record to convert * @returns JSON representation of the entity */ convertEntityObjectToJSON(record: BaseEntity): Promise<any>; /** * Creates key pairs for loading an entity * @param entity The entity info * @param parameters The parameters containing key values * @returns Array of key pairs for entity loading */ private createKeyPairsForLoading; /** * Gets an entity record by its primary key * @param entityName The name of the entity * @param parameters Parameters containing primary key values * @returns The operation result */ getEntity(entityName: string, parameters: OperationParameters): Promise<OperationResult>; /** * Creates a new entity record * @param entityName The name of the entity * @param parameters Field values for the new record * @returns The operation result */ createEntity(entityName: string, parameters: OperationParameters): Promise<OperationResult>; /** * Updates an existing entity record * @param entityName The name of the entity * @param parameters Parameters containing primary key and fields to update * @returns The operation result */ updateEntity(entityName: string, parameters: OperationParameters): Promise<OperationResult>; /** * Deletes an entity record * @param entityName The name of the entity * @param parameters Parameters containing primary key values * @returns The operation result */ deleteEntity(entityName: string, parameters: OperationParameters): Promise<OperationResult>; /** * Queries an entity * @param entityName The name of the entity * @param parameters Query parameters (extraFilter, orderBy, fields) * @returns The operation result */ queryEntity(entityName: string, parameters: OperationParameters): Promise<OperationResult>; /** * Parses a command from text content * @param textContent The text content to parse * @returns Parsed operation details */ parseCommandFromText(textContent: string): { operation: string; entityName: string; parameters: OperationParameters; }; /** * Processes an operation on an entity * @param operation The operation to perform (get, create, update, delete, query) * @param entityName The name of the entity * @param parameters The operation parameters * @returns The operation result */ processOperation(operation: string, entityName: string, parameters: OperationParameters): Promise<OperationResult>; } //# sourceMappingURL=EntityOperations.d.ts.map