Fix paginationValues being attached to every object inside a query due to recursion

This commit is contained in:
Andrew Kingston 2022-01-05 14:26:13 +00:00
parent 8aa4d49f31
commit 69a1b503c2
1 changed files with 6 additions and 7 deletions

View File

@ -32,6 +32,12 @@ class QueryRunner {
// pre-query, make sure datasource variables are added to parameters // pre-query, make sure datasource variables are added to parameters
const parameters = await this.addDatasourceVariables() const parameters = await this.addDatasourceVariables()
let query = this.enrichQueryFields(fields, parameters) let query = this.enrichQueryFields(fields, parameters)
// Add pagination values for REST queries
if (this.pagination) {
query.paginationValues = this.pagination
}
const Integration = integrations[datasource.source] const Integration = integrations[datasource.source]
if (!Integration) { if (!Integration) {
throw "Integration type does not exist." throw "Integration type does not exist."
@ -186,7 +192,6 @@ class QueryRunner {
enrichedQuery[key] = fields[key] enrichedQuery[key] = fields[key]
} }
} }
if ( if (
enrichedQuery.json || enrichedQuery.json ||
enrichedQuery.customData || enrichedQuery.customData ||
@ -203,12 +208,6 @@ class QueryRunner {
} }
delete enrichedQuery.customData delete enrichedQuery.customData
} }
// Just for REST queries
if (this.pagination) {
enrichedQuery.paginationValues = this.pagination
}
return enrichedQuery return enrichedQuery
} }
} }