/** * Augmentation Factory * * This module provides a simplified factory for creating augmentations with minimal boilerplate. * It reduces the complexity of creating and using augmentations by providing a fluent API * and handling common patterns automatically. */ import { IAugmentation, AugmentationResponse, ISenseAugmentation, IConduitAugmentation, IMemoryAugmentation, IWebSocketSupport, WebSocketConnection } from './types/augmentations.js'; /** * Options for creating an augmentation */ export interface AugmentationOptions { name: string; description?: string; enabled?: boolean; autoRegister?: boolean; autoInitialize?: boolean; } /** * Factory for creating sense augmentations */ export declare function createSenseAugmentation(options: AugmentationOptions & { processRawData?: (rawData: Buffer | string, dataType: string) => Promise> | AugmentationResponse<{ nouns: string[]; verbs: string[]; }>; listenToFeed?: (feedUrl: string, callback: (data: { nouns: string[]; verbs: string[]; }) => void) => Promise; }): ISenseAugmentation; /** * Factory for creating conduit augmentations */ export declare function createConduitAugmentation(options: AugmentationOptions & { establishConnection?: (targetSystemId: string, config: Record) => Promise> | AugmentationResponse; readData?: (query: Record, options?: Record) => Promise> | AugmentationResponse; writeData?: (data: Record, options?: Record) => Promise> | AugmentationResponse; monitorStream?: (streamId: string, callback: (data: unknown) => void) => Promise; }): IConduitAugmentation; /** * Factory for creating memory augmentations */ export declare function createMemoryAugmentation(options: AugmentationOptions & { storeData?: (key: string, data: unknown, options?: Record) => Promise> | AugmentationResponse; retrieveData?: (key: string, options?: Record) => Promise> | AugmentationResponse; updateData?: (key: string, data: unknown, options?: Record) => Promise> | AugmentationResponse; deleteData?: (key: string, options?: Record) => Promise> | AugmentationResponse; listDataKeys?: (pattern?: string, options?: Record) => Promise> | AugmentationResponse; search?: (query: unknown, k?: number, options?: Record) => Promise>> | AugmentationResponse>; }): IMemoryAugmentation; /** * Factory for creating WebSocket-enabled augmentations * This can be combined with other augmentation factories to create WebSocket-enabled versions */ export declare function addWebSocketSupport(augmentation: T, options: { connectWebSocket?: (url: string, protocols?: string | string[]) => Promise; sendWebSocketMessage?: (connectionId: string, data: unknown) => Promise; onWebSocketMessage?: (connectionId: string, callback: (data: unknown) => void) => Promise; offWebSocketMessage?: (connectionId: string, callback: (data: unknown) => void) => Promise; closeWebSocket?: (connectionId: string, code?: number, reason?: string) => Promise; }): T & IWebSocketSupport; /** * Simplified function to execute an augmentation method with automatic error handling * This provides a more concise way to execute augmentation methods compared to the full pipeline */ export declare function executeAugmentation(augmentation: IAugmentation, method: string, ...args: any[]): Promise>; /** * Dynamically load augmentations from a module at runtime * This allows for lazy-loading augmentations when needed instead of at build time */ export declare function loadAugmentationModule(modulePromise: Promise, options?: { autoRegister?: boolean; autoInitialize?: boolean; }): Promise;