@hashgraphonline/conversational-agent
Version:
Hashgraph Online conversational AI agent implementing HCS-10 communication, HCS-2 registries, and content inscription on Hedera. https://hol.org
67 lines (65 loc) • 1.92 kB
TypeScript
import { EntityFormat, FormatConverter, ConversionContext } from './types';
/**
* Registry for format converters that handles entity transformation
*/
export declare class FormatConverterRegistry {
private converters;
private entityTypeCache;
private logger;
private defaultCacheTTL;
/**
* Register a format converter
*/
register<TSource, TTarget>(converter: FormatConverter<TSource, TTarget>): void;
/**
* Find a converter for the given source and target formats
*/
findConverter(source: EntityFormat, target: EntityFormat): FormatConverter<unknown, unknown> | null;
/**
* Convert an entity to the target format
*/
convertEntity(entity: string, target: EntityFormat, context: ConversionContext): Promise<string>;
/**
* Detect the format of an entity string with API-based verification and fallback
*/
private detectFormatWithFallback;
/**
* Public helper: detect entity format (ACCOUNT_ID, TOKEN_ID, TOPIC_ID, HRL, or ANY)
*/
detectEntityFormat(entity: string, context?: ConversionContext): Promise<EntityFormat>;
/**
* Detect entity format via Hedera Mirror Node API calls
*/
private detectFormat;
/**
* Get cached entity format if valid
*/
private getCachedFormat;
/**
* Set cached entity format
*/
private setCachedFormat;
/**
* Check if cache entry is expired
*/
private isCacheExpired;
/**
* Get all registered converters
*/
getRegisteredConverters(): Array<{
source: EntityFormat;
target: EntityFormat;
}>;
/**
* Check if a converter exists for the given formats
*/
hasConverter(source: EntityFormat, target: EntityFormat): boolean;
/**
* Clear all registered converters
*/
clear(): void;
/**
* Clear entity type cache
*/
clearCache(): void;
}