Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function run (endPoint: string, query: QueryType, type: GotQL.ExecutionType, got: GotInstance, options?: UserOptions): Promise {
try {
info('Invoking runner with query type %s', type)
if (!['query', 'mutation'].includes(type)) throw new Error('Query type must be either `query` or `mutation`')
info('Parsing query: %O', query)
const graphQuery = parse(query, type) // Parses JSON into GraphQL Query
info('Parsed query: %s', graphQuery)
info('Building payload object')
const headers = options ? options.headers : {}
const gotPayload = getPayload(headers, query, graphQuery)
info('Payload object: %O', gotPayload.body)
info('Sending request...')
let response = await got.post(prependHttp(endPoint), gotPayload)
info('Response: %O', response.body.toString())
return handleResponse(response, options)
} catch (error) {
shout('Error on runner: %O', error)
throw new RunnerError(`Error when executing query: ${error.message}`)
}
}
onSubmit={event => {
event.preventDefault()
const url = prependHttp(inputValue)
onSubmit(isUrl(url) ? url : undefined)
}}
>
avatar = `${config.host.website}${avatar}`
}
const u = {
...userCollective.dataValues,
tier: userCollective.tier && userCollective.tier.slug,
avatar
};
delete u.image;
if (!u.tier) {
u.tier = (u.type === 'USER') ? 'backer' : 'sponsor';
}
if (!req.collective || !req.remoteUser || !req.remoteUser.isAdmin(req.collective.id)) {
delete u.email;
}
if (u.website) {
u.website = prependHttp(u.website);
}
return u;
})
.then(users => res.send(users))
get() {
const website = this.getDataValue('website');
if (website) {
return prependHttp(website);
}
return this.getDataValue('twitterHandle')
? `https://twitter.com/${this.getDataValue('twitterHandle')}`
: null;
},
set(url) {
normalizeUrl = (url) => {
return prependHttp(url);
}
function normalizeUrl(url) {
return prependHttp(url);
}
useEffect(() => {
if (isLoading) return
const value = prependHttp(inputValue)
if (!isUrl(value)) return setData(demoLink.data)
const item = suggestions.find(({ value }) => value === inputValue)
if (item) setData(item.data)
else fetchAndSetData(value)
}, [inputValue])
const media =
previewView === 'iframe'
? ['iframe', 'video', 'audio', 'image', 'logo']
: ['video', 'audio', 'image', 'logo']
const targetUrlPrepend = prependHttp(demoLink.data.url)
return (
<>
{
event.preventDefault()
avatar = `${config.host.website}${avatar}`;
}
const u = {
...userCollective.dataValues,
tier: userCollective.tier && userCollective.tier.slug,
avatar,
};
delete u.image;
if (!u.tier) {
u.tier = u.type === 'USER' ? 'backer' : 'sponsor';
}
if (!req.collective || !req.remoteUser || !req.remoteUser.isAdmin(req.collective.id)) {
delete u.email;
}
if (u.website) {
u.website = prependHttp(u.website);
}
return u;
})
.then(users => res.send(users))