( dbadapter: IDbAdapter, targets: dataform.ITarget[] )
| 2 | import { dataform } from "df/protos/ts"; |
| 3 | |
| 4 | export async function state( |
| 5 | dbadapter: IDbAdapter, |
| 6 | targets: dataform.ITarget[] |
| 7 | ): Promise<dataform.IWarehouseState> { |
| 8 | const allTables = await Promise.all(targets.map(async target => dbadapter.table(target))); |
| 9 | |
| 10 | // Filter out datasets that don't exist. |
| 11 | const tablesWithValues = allTables.filter(table => { |
| 12 | return !!table && !!table.type; |
| 13 | }); |
| 14 | return { tables: tablesWithValues }; |
| 15 | } |