Major version update. Major bugfixes. Security vulnerabilites fixed
This commit is contained in:
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
import _ from "lodash";
|
||||
/**
|
||||
* Resolve a table's effective definition. Tables with `parentTableName`
|
||||
* take their structure from the parent. Always returns a copy: the schema
|
||||
* objects are never mutated.
|
||||
*/
|
||||
export default function resolveTable({ table, db_schema, }) {
|
||||
if (!table.parentTableName) {
|
||||
return _.cloneDeep(table);
|
||||
}
|
||||
const parent_table = db_schema.tables.find((t) => t.tableName === table.parentTableName);
|
||||
if (!parent_table) {
|
||||
throw new Error(`Parent table \`${table.parentTableName}\` not found for \`${table.tableName}\``);
|
||||
}
|
||||
return _.merge(_.cloneDeep(parent_table), {
|
||||
tableName: table.tableName,
|
||||
tableDescription: table.tableDescription,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user