Types
This commit is contained in:
parent
0b0b6ddb13
commit
716e642d08
|
@ -1,10 +1,10 @@
|
||||||
import { QuerySchema, Row } from "@budibase/types"
|
import { Datasource, QuerySchema, Row } from "@budibase/types"
|
||||||
|
|
||||||
export type WorkerCallback = (error: any, response?: any) => void
|
export type WorkerCallback = (error: any, response?: any) => void
|
||||||
|
|
||||||
export interface QueryEvent {
|
export interface QueryEvent {
|
||||||
appId?: string
|
appId?: string
|
||||||
datasource: any
|
datasource: Datasource
|
||||||
queryVerb: string
|
queryVerb: string
|
||||||
fields: { [key: string]: any }
|
fields: { [key: string]: any }
|
||||||
parameters: { [key: string]: any }
|
parameters: { [key: string]: any }
|
||||||
|
|
|
@ -14,13 +14,13 @@ import { context, cache, auth } from "@budibase/backend-core"
|
||||||
import { getGlobalIDFromUserMetadataID } from "../db/utils"
|
import { getGlobalIDFromUserMetadataID } from "../db/utils"
|
||||||
import sdk from "../sdk"
|
import sdk from "../sdk"
|
||||||
import { cloneDeep } from "lodash/fp"
|
import { cloneDeep } from "lodash/fp"
|
||||||
import { Query } from "@budibase/types"
|
import { Datasource, Query } from "@budibase/types"
|
||||||
|
|
||||||
import { isSQL } from "../integrations/utils"
|
import { isSQL } from "../integrations/utils"
|
||||||
import { interpolateSQL } from "../integrations/queries/sql"
|
import { interpolateSQL } from "../integrations/queries/sql"
|
||||||
|
|
||||||
class QueryRunner {
|
class QueryRunner {
|
||||||
datasource: any
|
datasource: Datasource
|
||||||
queryVerb: string
|
queryVerb: string
|
||||||
queryId: string
|
queryId: string
|
||||||
fields: any
|
fields: any
|
||||||
|
@ -68,7 +68,7 @@ class QueryRunner {
|
||||||
throw "Integration type does not exist."
|
throw "Integration type does not exist."
|
||||||
}
|
}
|
||||||
|
|
||||||
if (datasourceClone.config.authConfigs) {
|
if (datasourceClone.config?.authConfigs) {
|
||||||
const updatedConfigs = []
|
const updatedConfigs = []
|
||||||
for (let config of datasourceClone.config.authConfigs) {
|
for (let config of datasourceClone.config.authConfigs) {
|
||||||
updatedConfigs.push(await sdk.queries.enrichContext(config, this.ctx))
|
updatedConfigs.push(await sdk.queries.enrichContext(config, this.ctx))
|
||||||
|
@ -93,7 +93,7 @@ class QueryRunner {
|
||||||
const enrichedContext = { ...enrichedParameters, ...this.ctx }
|
const enrichedContext = { ...enrichedParameters, ...this.ctx }
|
||||||
|
|
||||||
// Parse global headers
|
// Parse global headers
|
||||||
if (datasourceClone.config.defaultHeaders) {
|
if (datasourceClone.config?.defaultHeaders) {
|
||||||
datasourceClone.config.defaultHeaders = await sdk.queries.enrichContext(
|
datasourceClone.config.defaultHeaders = await sdk.queries.enrichContext(
|
||||||
datasourceClone.config.defaultHeaders,
|
datasourceClone.config.defaultHeaders,
|
||||||
enrichedContext
|
enrichedContext
|
||||||
|
|
Loading…
Reference in New Issue