Skip to content
← Public packages

@kentcdodds/fly

Manage Fly.io apps, Machines, logs, and metrics.

src/graphql.ts

17 lines · 601 B · TypeScript
import { requestGraphql } from './core.ts'
import type { FlyGraphqlInput } from './types.ts'

export { requestGraphql }

/**
 * Run a custom Fly.io GraphQL query using `flyApiToken`.
 * @param params.query - GraphQL query string.
 * @returns Parsed GraphQL `data` payload from Fly.
 * @example
 * import graphql from 'kody:@kentcdodds/fly/graphql'
 * const result = await graphql({ query: '{ organizations { nodes { slug } } }' })
 * // => { organizations: { nodes: [...] } }
 */
export default async function graphql(params: FlyGraphqlInput = { query: '' }) {
  return await requestGraphql(params)
}