1
0
Fork 0
mirror of synced 2024-06-26 18:10:51 +12:00

Fixing issue with plugin import for datasources - extract the integration correctly.

This commit is contained in:
mike12345567 2022-09-13 12:16:00 +01:00
parent ffed456c9c
commit 781832a52a
2 changed files with 7 additions and 2 deletions

View file

@ -94,11 +94,16 @@ module.exports = {
for (let plugin of plugins) { for (let plugin of plugins) {
if (plugin.name === integration) { if (plugin.name === integration) {
// need to use commonJS require due to its dynamic runtime nature // need to use commonJS require due to its dynamic runtime nature
return getDatasourcePlugin( const retrieved: any = await getDatasourcePlugin(
plugin.name, plugin.name,
plugin.jsUrl, plugin.jsUrl,
plugin.schema?.hash plugin.schema?.hash
) )
if (retrieved.integration) {
return retrieved.integration
} else {
return retrieved
}
} }
} }
} }

View file

@ -415,7 +415,7 @@ exports.getDatasourcePlugin = async (name, url, hash) => {
const content = await response.text() const content = await response.text()
fs.writeFileSync(filename, content) fs.writeFileSync(filename, content)
fs.writeFileSync(metadataName, hash) fs.writeFileSync(metadataName, hash)
require(filename) return require(filename)
} else { } else {
throw new Error( throw new Error(
`Unable to retrieve plugin - reason: ${await response.text()}` `Unable to retrieve plugin - reason: ${await response.text()}`