const initSqlJs = require('sql.js');
const fs = require('fs');

initSqlJs().then(SQL => {
    const buffer = fs.readFileSync('E:/var/lib/9router/db/data.sqlite');
    const db = new SQL.Database(buffer);
    
    // Get schema
    const schema = db.exec("SELECT sql FROM sqlite_master WHERE name='apiKeys'");
    console.log('apiKeys schema:', schema[0]?.values[0][0]);
    
    // Get first key
    const result = db.exec("SELECT * FROM apiKeys LIMIT 1");
    if (result[0]) {
        console.log('\nColumns:', result[0].columns);
        console.log('First row:', result[0].values[0]);
    }
    
    db.close();
    process.exit(0);
});
