Merge branch 'master' into fix/multiple-relationships-same-table

This commit is contained in:
Adria Navarro 2024-10-16 15:15:52 +02:00 committed by GitHub
commit ef21c7135f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -173,9 +173,9 @@ export class ExternalRequest<T extends Operation> {
if (!opts.datasource) {
if (sdk.views.isView(source)) {
const table = await sdk.views.getTable(source.id)
opts.datasource = await sdk.datasources.get(table.sourceId!)
opts.datasource = await sdk.datasources.get(table.sourceId)
} else {
opts.datasource = await sdk.datasources.get(source.sourceId!)
opts.datasource = await sdk.datasources.get(source.sourceId)
}
}

View File

@ -90,7 +90,11 @@ export async function getExternalTable(
if (!entities[tableName]) {
throw new Error(`Unable to find table named "${tableName}"`)
}
return processTable(entities[tableName])
const table = await processTable(entities[tableName])
if (!table.sourceId) {
table.sourceId = datasourceId
}
return table
}
export async function getTable(tableId: string): Promise<Table> {