import { TableInterface } from '../../../../typings' ; import { Table } from './table' ; /**
 * Database, which contains array of tables in compact format.
 */ export class Database { /**
     * Tables array in compact JSON format.
     */ compactJsonTables : TableInterface [ ] = [ ] ; /**
     * Table models after parsed.
     */ tables : Table [ ] = [ ] ; /**
     * Getter for tables.
     */ getTables ( ) { return this . tables ; } param tables setTables ( tables ) { this . tables = tables ; } param name getTable ( name ) { return this . tables . find ( ( t ) => t . name === name ) ; } param table pushTable ( table ) { /**
         * Do not add table with same name.
         */ if ( this . tables . some ( ( t ) => t . name === table . name ) ) { return ; } this . tables . push ( table ) ; } param tables parseCompactJson ( tables ) { this . setTables ( tables . map ( ( table ) => Table . fromCompactJson ( table ) ) ) ; } }