/** * Vector Action type definitions * * Defines interfaces for creating, managing, and executing * reusable vector database actions (query templates). */ import { VectorActionTypes } from '../../types/productsBuilder.types'; /** * Re-export VectorActionTypes for convenience */ export { VectorActionTypes }; /** * Map of VectorActionTypes to string values for runtime use */ export declare const VectorActionTypeMap: Record; /** * Vector action definition */ export interface IVectorActionDefinition { /** Human-readable name */ name: string; /** Unique tag in format: vector_tag:action_tag */ tag: string; /** Action type/operation */ operation: VectorActionTypes | string; /** Description of what this action does */ description?: string; /** Query template with placeholders */ template: IVectorActionTemplate; /** Extracted parameters */ parameters: IVectorActionParam[]; /** Created timestamp */ createdAt?: Date; /** Updated timestamp */ updatedAt?: Date; } /** * Vector action template with placeholders * Placeholders use {{variableName}} syntax */ export interface IVectorActionTemplate { /** Namespace (supports placeholder) */ namespace?: string; /** TopK for queries (supports placeholder) */ topK?: number | string; /** Include metadata flag */ includeMetadata?: boolean; /** Include values flag */ includeValues?: boolean; /** Vector IDs for fetch/delete operations */ ids?: string[] | string; /** Single ID for exists/fetchOne */ id?: string; /** Query text for semantic search */ text?: string; /** Query vector for similarity search */ vector?: number[] | string; /** Metadata filter */ filter?: Record; /** Limit for list operations */ limit?: number | string; /** Vectors for upsert operations */ vectors?: Array<{ id: string; values?: number[]; metadata?: Record; }> | string; /** Metadata for update operations */ metadata?: Record; /** Any additional options */ [key: string]: any; } /** * Action parameter definition */ export interface IVectorActionParam { /** Parameter name (without braces) */ name: string; /** JSON path in template */ path: string; /** Expected type */ type: 'string' | 'number' | 'boolean' | 'array' | 'object'; /** Required flag */ required?: boolean; /** Default value if not provided */ defaultValue?: any; /** Description */ description?: string; } /** * Options for creating a vector action */ export interface IVectorActionCreateOptions { /** Product tag */ product: string; /** Vector database tag */ vector: string; /** Human-readable name */ name: string; /** Unique action tag (will be prefixed with vector_tag:) */ actionTag: string; /** Action type */ operation: VectorActionTypes | string; /** Description of what this action does */ description?: string; /** Query template with placeholders */ template: IVectorActionTemplate; /** Parameters extracted from template */ parameters?: IVectorActionParam[]; } /** * Options for updating a vector action */ export interface IVectorActionUpdateOptions { /** Product tag */ product: string; /** Vector database tag */ vector: string; /** Action tag to update */ actionTag: string; /** New name */ name?: string; /** New description */ description?: string; /** New template */ template?: IVectorActionTemplate; /** New parameters */ parameters?: IVectorActionParam[]; } /** * Options for executing a vector action */ export interface IVectorActionExecuteOptions { /** Product tag */ product: string; /** Environment */ env: string; /** Vector database tag */ vector: string; /** Action tag (without vector prefix) */ action: string; /** Input values for template placeholders */ input: Record; /** Session token in format: session_tag:jwt_token */ session?: string; } /** * Options for fetching vector actions */ export interface IVectorActionFetchOptions { /** Product tag */ product: string; /** Vector database tag */ vector: string; /** Optional: specific action tag */ actionTag?: string; } /** * Options for deleting a vector action */ export interface IVectorActionDeleteOptions { /** Product tag */ product: string; /** Vector database tag */ vector: string; /** Action tag to delete */ actionTag: string; } /** * Result of action execution */ export interface IVectorActionResult { /** Whether execution succeeded */ success: boolean; /** Result data */ data?: T; /** Error message if failed */ error?: string; /** Execution time in ms */ executionTime?: number; /** The resolved template that was executed */ resolvedTemplate?: IVectorActionTemplate; } /** * Placeholder regex pattern: {{variableName}} */ export declare const PLACEHOLDER_REGEX: RegExp; /** * Extract placeholders from a value */ export declare function extractPlaceholders(value: any): string[]; /** * Resolve placeholders in a template */ export declare function resolvePlaceholders(template: T, input: Record): T;