<commit_before>import Apis from "rpc_api/ApiInstances"

import PrivateKey from 'ecc/key_private'
import PublicKey from 'ecc/key_public'
import Aes from 'ecc/aes'
import key from "common/key_utils"

import WalletDb from 'stores/WalletDb'
import WalletManagerStore from 'stores/WalletManagerStore'
import AccountStore from 'stores/AccountStore'
import PrivateKeyStore from 'stores/PrivateKeyStore'
import ChainStore from "api/ChainStore"

import BackupActions from "actions/BackupActions"

import alt from 'alt-instance'
import iDB from 'idb-instance'


module.exports = {
    
    PrivateKey, PublicKey, Aes, key,
    WalletDb, WalletManagerStore, PrivateKeyStore,
    AccountStore, 
    BackupActions,
    ChainStore,
    
    alt, iDB,  Apis,
    db: Apis.instance().db_api(), // todo, fix db == undefined
    
    resolve: (object, atty = "_") => {
        if( ! object["then"]) {
            console.log(object)
            return object
        }
        return new Promise( (resolve, reject) => {
            object.then( result => {
                console.log(result)
                resolve(result)
                window[atty] = result
            }).catch( error => {
                console.error(error)
                reject(error)
                window[atty] = error
            })
        })
    },
    
    init: context => {
        if( ! context) return
        for (var obj in module.exports) {
            if(obj === "init") continue
            context[obj] = module.exports[obj]
        }
    }
    
}
<commit_msg>Fixes db() command in browser console<commit_after>import Apis from "rpc_api/ApiInstances"

import PrivateKey from 'ecc/key_private'
import PublicKey from 'ecc/key_public'
import Aes from 'ecc/aes'
import key from "common/key_utils"

import WalletDb from 'stores/WalletDb'
import WalletManagerStore from 'stores/WalletManagerStore'
import AccountStore from 'stores/AccountStore'
import PrivateKeyStore from 'stores/PrivateKeyStore'
import ChainStore from "api/ChainStore"

import BackupActions from "actions/BackupActions"

import alt from 'alt-instance'
import iDB from 'idb-instance'


module.exports = {
    
    PrivateKey, PublicKey, Aes, key,
    WalletDb, WalletManagerStore, PrivateKeyStore,
    AccountStore, 
    BackupActions,
    ChainStore,
    
    alt, iDB,  Apis,
    db: ()=> Apis.instance().db_api(),
    
    resolve: (object, atty = "_") => {
        if( ! object["then"]) {
            console.log(object)
            return object
        }
        return new Promise( (resolve, reject) => {
            object.then( result => {
                console.log(result)
                resolve(result)
                window[atty] = result
            }).catch( error => {
                console.error(error)
                reject(error)
                window[atty] = error
            })
        })
    },
    
    init: context => {
        if( ! context) return
        for (var obj in module.exports) {
            if(obj === "init") continue
            context[obj] = module.exports[obj]
        }
    }
    
}

{'fraction_non_alphanumeric': 0.10507482108002603, 'fraction_numerical': 0.0, 'mean_word_length': 2.1997918834547345, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1839518', 'n_tokens_mistral': 911, 'n_tokens_neox': 899, 'n_words': 225}