Fixing issue with plugin import for datasources - extract the integration correctly.
This commit is contained in:
parent
ffed456c9c
commit
781832a52a
|
@ -94,11 +94,16 @@ module.exports = {
|
|||
for (let plugin of plugins) {
|
||||
if (plugin.name === integration) {
|
||||
// need to use commonJS require due to its dynamic runtime nature
|
||||
return getDatasourcePlugin(
|
||||
const retrieved: any = await getDatasourcePlugin(
|
||||
plugin.name,
|
||||
plugin.jsUrl,
|
||||
plugin.schema?.hash
|
||||
)
|
||||
if (retrieved.integration) {
|
||||
return retrieved.integration
|
||||
} else {
|
||||
return retrieved
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -415,7 +415,7 @@ exports.getDatasourcePlugin = async (name, url, hash) => {
|
|||
const content = await response.text()
|
||||
fs.writeFileSync(filename, content)
|
||||
fs.writeFileSync(metadataName, hash)
|
||||
require(filename)
|
||||
return require(filename)
|
||||
} else {
|
||||
throw new Error(
|
||||
`Unable to retrieve plugin - reason: ${await response.text()}`
|
||||
|
|
Loading…
Reference in New Issue