|
|
@ -19,8 +19,8 @@ function hasExtraData(response) { |
|
|
return ( |
|
|
return ( |
|
|
typeof response === "object" && |
|
|
typeof response === "object" && |
|
|
!Array.isArray(response) && |
|
|
!Array.isArray(response) && |
|
|
response.data && |
|
|
response.data != null && |
|
|
response.info |
|
|
response.info != null |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -34,11 +34,11 @@ async function runAndTransform(datasource, queryVerb, query, transformer) { |
|
|
let output = formatResponse(await integration[queryVerb](query)) |
|
|
let output = formatResponse(await integration[queryVerb](query)) |
|
|
let rows = output, |
|
|
let rows = output, |
|
|
info = undefined, |
|
|
info = undefined, |
|
|
raw = undefined |
|
|
extra = undefined |
|
|
if (hasExtraData(output)) { |
|
|
if (hasExtraData(output)) { |
|
|
rows = output.data |
|
|
rows = output.data |
|
|
info = output.info |
|
|
info = output.info |
|
|
raw = output.raw |
|
|
extra = output.extra |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// transform as required
|
|
|
// transform as required
|
|
|
@ -64,7 +64,7 @@ async function runAndTransform(datasource, queryVerb, query, transformer) { |
|
|
integration.end() |
|
|
integration.end() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return { rows, keys, info, raw } |
|
|
return { rows, keys, info, extra } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
module.exports = (input, callback) => { |
|
|
module.exports = (input, callback) => { |
|
|
|