Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (body.errors && body.errors.length > 0) {
errorMessage = body.errors.map((item: Error) => item.message).join(', ');
} else if (!body.data) {
errorMessage = body;
}
if (errorMessage) {
throw new Error('Unable to download schema from remote: ' + errorMessage);
}
if (!body.data.__schema) {
throw new Error('Invalid schema provided!');
}
const clientSchema = buildClientSchema(body.data as IntrospectionQuery, options as any);
const remoteExecutableSchema = makeRemoteExecutableSchema({
schema: clientSchema,
fetcher,
});
return {
location: pointer,
schema: remoteExecutableSchema,
};
}
}