INNER CODE UNIT · TypeScript
getRemoteSchema
prisma-labs/get-graphql-schema · src/index.ts:52
export async function getRemoteSchema(
endpoint: string,
options: Options,
): Promise<
{ status: 'ok'; schema: string } | { status: 'err'; message: string }
> {
try {
const { data, errors } = await fetch(endpoint, {
method: options.method,
headers: options.headers,
body: JSON.stringify({ query: introspectionQuery }),
}).then(res => res.json())
if (errors) {
return { status: 'err', message: JSON.stringify(errors, null, 2) }
}
if (options.json) {