45 lines
1.8 KiB
TypeScript
45 lines
1.8 KiB
TypeScript
/** Options for controlling the migration process. */
|
|
export interface RvfMigrationOptions {
|
|
verbose?: boolean;
|
|
/** Entries per batch (default 500). */
|
|
batchSize?: number;
|
|
/** Embedding dimensions for target RVF file (default 1536). */
|
|
dimensions?: number;
|
|
onProgress?: (progress: {
|
|
current: number;
|
|
total: number;
|
|
phase: string;
|
|
}) => void;
|
|
}
|
|
/** Result returned after a migration completes. */
|
|
export interface RvfMigrationResult {
|
|
success: boolean;
|
|
entriesMigrated: number;
|
|
sourceFormat: string;
|
|
targetFormat: string;
|
|
durationMs: number;
|
|
errors: string[];
|
|
}
|
|
/**
|
|
* Bidirectional migration utility between RVF and legacy memory formats.
|
|
*
|
|
* All methods are static — no instantiation required.
|
|
*/
|
|
export declare class RvfMigrator {
|
|
/** Migrate a JSON memory file to RVF format. */
|
|
static fromJsonFile(jsonPath: string, rvfPath: string, options?: RvfMigrationOptions): Promise<RvfMigrationResult>;
|
|
/** Migrate a SQLite (better-sqlite3 / sql.js) database to RVF. */
|
|
static fromSqlite(dbPath: string, rvfPath: string, options?: RvfMigrationOptions): Promise<RvfMigrationResult>;
|
|
/** Export an RVF file back to a JSON array (backward compatibility). */
|
|
static toJsonFile(rvfPath: string, jsonPath: string): Promise<RvfMigrationResult>;
|
|
/**
|
|
* Detect file format by magic bytes.
|
|
* - RVF\0 (0x52 0x56 0x46 0x00) -> 'rvf'
|
|
* - SQLi (0x53 0x51 0x4C 0x69) -> 'sqlite'
|
|
* - Leading [ or { -> 'json'
|
|
*/
|
|
static detectFormat(filePath: string): Promise<'rvf' | 'json' | 'sqlite' | 'unknown'>;
|
|
/** Auto-detect source format and migrate to RVF. */
|
|
static autoMigrate(sourcePath: string, targetRvfPath: string, options?: RvfMigrationOptions): Promise<RvfMigrationResult>;
|
|
}
|
|
//# sourceMappingURL=rvf-migration.d.ts.map
|