dexie-export-import
Version:
Dexie addon that adds export and import capabilities
32 lines (31 loc) • 1.38 kB
TypeScript
import Dexie from 'dexie';
import { DexieExportJsonMeta, DexieExportJsonStructure } from './json-structure';
import { JsonStream } from './json-stream';
export interface StaticImportOptions {
noTransaction?: boolean;
chunkSizeBytes?: number;
filter?: (table: string, value: any, key?: any) => boolean;
progressCallback?: (progress: ImportProgress) => boolean;
}
export interface ImportOptions extends StaticImportOptions {
acceptMissingTables?: boolean;
acceptVersionDiff?: boolean;
acceptNameDiff?: boolean;
acceptChangedPrimaryKey?: boolean;
overwriteValues?: boolean;
clearTablesBeforeImport?: boolean;
noTransaction?: boolean;
chunkSizeBytes?: number;
filter?: (table: string, value: any, key?: any) => boolean;
progressCallback?: (progress: ImportProgress) => boolean;
}
export interface ImportProgress {
totalTables: number;
completedTables: number;
totalRows: number | undefined;
completedRows: number;
done: boolean;
}
export declare function importDB(exportedData: Blob | JsonStream<DexieExportJsonStructure>, options?: StaticImportOptions): Promise<Dexie>;
export declare function peakImportFile(exportedData: Blob): Promise<DexieExportJsonMeta>;
export declare function importInto(db: Dexie, exportedData: Blob | JsonStream<DexieExportJsonStructure>, options?: ImportOptions): Promise<void>;