Simplify the function signature of processInternalTables
This commit is contained in:
parent
e03b1be9d1
commit
4a00649f7f
|
@ -19,8 +19,8 @@ import {
|
||||||
import datasources from "../datasources"
|
import datasources from "../datasources"
|
||||||
import sdk from "../../../sdk"
|
import sdk from "../../../sdk"
|
||||||
|
|
||||||
function processInternalTables(docs: AllDocsResponse<Table[]>): Table[] {
|
function processInternalTables(tables: Table[]): Table[] {
|
||||||
return docs.rows.map(tableDoc => processInternalTable(tableDoc.doc))
|
return tables.map(processInternalTable)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function processInternalTable(table: Table): Table {
|
export function processInternalTable(table: Table): Table {
|
||||||
|
@ -40,7 +40,7 @@ export async function getAllInternalTables(db?: Database): Promise<Table[]> {
|
||||||
include_docs: true,
|
include_docs: true,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
return processInternalTables(internalTables)
|
return processInternalTables(internalTables.rows.map(row => row.doc!))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getAllExternalTables(): Promise<Table[]> {
|
async function getAllExternalTables(): Promise<Table[]> {
|
||||||
|
@ -110,7 +110,9 @@ export async function getTables(tableIds: string[]): Promise<Table[]> {
|
||||||
const internalTableDocs = await db.allDocs<Table[]>(
|
const internalTableDocs = await db.allDocs<Table[]>(
|
||||||
getMultiIDParams(internalTableIds)
|
getMultiIDParams(internalTableIds)
|
||||||
)
|
)
|
||||||
tables = tables.concat(processInternalTables(internalTableDocs))
|
tables = tables.concat(
|
||||||
|
processInternalTables(internalTableDocs.rows.map(row => row.doc!))
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return tables
|
return tables
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue