Skip to content
← Public packages

@apphub/fly

Inspect and manage Fly.io apps, Machines, logs, and metrics with dry-run mutations.

src/graphql.ts

17 lines · 600 B · TypeScript
import { requestGraphql } from './fly-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:@apphub/fly/graphql'
 * const result = await graphql({ query: '{ organizations { nodes { slug } } }' })
 * // => { organizations: { nodes: [...] } }
 */
export default async function graphql(params: FlyGraphqlInput = { query: '' }) {
	return await requestGraphql(params)
}