Browse Source
			
			
			
			
				
		- Add FileSystem and FileStream interfaces for filesystem operations - Update Database interface with proper Promise-based return types - Add QueryExecResult interface for structured query results - Include FS and register_for_idb in initialization result - Fix Database constructor to support path and options parameters - Add proper JSDoc documentation with author and description This change resolves TypeScript compilation errors in AbsurdSqlDatabaseService by providing complete type coverage for the SQL.js WASM module with filesystem support.
				 1 changed files with 57 additions and 0 deletions
			
			
		@ -0,0 +1,57 @@ | 
				
			|||
/** | 
				
			|||
 * Type definitions for @jlongster/sql.js | 
				
			|||
 * @author Matthew Raymer | 
				
			|||
 * @description TypeScript declaration file for the SQL.js WASM module with filesystem support | 
				
			|||
 */ | 
				
			|||
 | 
				
			|||
declare module '@jlongster/sql.js' { | 
				
			|||
  export interface FileSystem { | 
				
			|||
    mkdir(path: string): void; | 
				
			|||
    mount(fs: any, opts: any, mountpoint: string): void; | 
				
			|||
    open(path: string, flags: string): FileStream; | 
				
			|||
    close(stream: FileStream): void; | 
				
			|||
  } | 
				
			|||
 | 
				
			|||
  export interface FileStream { | 
				
			|||
    node: { | 
				
			|||
      contents: { | 
				
			|||
        readIfFallback(): Promise<void>; | 
				
			|||
      }; | 
				
			|||
    }; | 
				
			|||
  } | 
				
			|||
 | 
				
			|||
  export interface Database { | 
				
			|||
    exec(sql: string, params?: any[]): Promise<QueryExecResult[]>; | 
				
			|||
    prepare(sql: string): Statement; | 
				
			|||
    run(sql: string, params?: any[]): Promise<{ changes: number; lastId?: number }>; | 
				
			|||
    close(): void; | 
				
			|||
  } | 
				
			|||
 | 
				
			|||
  export interface QueryExecResult { | 
				
			|||
    columns: string[]; | 
				
			|||
    values: any[][]; | 
				
			|||
  } | 
				
			|||
 | 
				
			|||
  export interface Statement { | 
				
			|||
    bind(params: any[]): void; | 
				
			|||
    step(): boolean; | 
				
			|||
    get(): any[]; | 
				
			|||
    getColumnNames(): string[]; | 
				
			|||
    reset(): void; | 
				
			|||
    free(): void; | 
				
			|||
  } | 
				
			|||
 | 
				
			|||
  export interface InitSqlJsStatic { | 
				
			|||
    (config?: { | 
				
			|||
      locateFile?: (file: string) => string; | 
				
			|||
      wasmBinary?: ArrayBuffer; | 
				
			|||
    }): Promise<{ | 
				
			|||
      Database: new (path?: string | Uint8Array, opts?: { filename?: boolean }) => Database; | 
				
			|||
      FS: FileSystem; | 
				
			|||
      register_for_idb: (fs: any) => void; | 
				
			|||
    }>; | 
				
			|||
  } | 
				
			|||
 | 
				
			|||
  const initSqlJs: InitSqlJsStatic; | 
				
			|||
  export default initSqlJs; | 
				
			|||
}  | 
				
			|||
					Loading…
					
					
				
		Reference in new issue