const axios = require('axios'), fs = require('fs'); let param = JSON.parse(fs.readFileSync('param.JSON', 'utf-8')) module.exports = function(api) { api.loadSource(async actions => { for (let d in param.meta) { actions.addMetadata(d, param.meta[d]) } if (!param.search) throw "Nothing to search for"; let search = param.search.map(s => { return axios.get(`${param.source}${s}`); }); await axios.all(search).then(res => { param.search.forEach((p, index) => { let action = actions.addCollection(p), { data } = res[index]; for (const item of data) { action.addNode(item) } }); }); }) }