A JavaScript DSL for constructing GraphQL queries programmatically. v0.2.3 (pre-1.0, experimental). Converts a plain object representation into a valid GraphQL query string with support for arguments, variables, and fragment composition. Key differentiators: extremely lightweight (~1KB), no runtime GraphQL parser, TypeScript-first with full type inference for fields and arguments, and includes compileWithVariableValues for extracting both query and variable bindings. Ideal for codebases that need to dynamically generate queries without the overhead of graphql-tag or Apollo.
npm install tiny-graphql-query-compilerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic compile, arguments with Call and Var, and compileWithVariableValues for extracting query and variables.
Pin to a specific version and monitor changelog.
Currently no fix; be prepared to update string literals if types are later represented as TypeScript enums.
Use named imports: import { Call, Var } from 'tiny-graphql-query-compiler'.Always test generated queries against a real GraphQL endpoint or use a validator like graphql-js.
Ensure you import Call: import { Call } from 'tiny-graphql-query-compiler'.Use import syntax in an ESM context, or configure Node.js to treat the package as ESM (e.g., set type: 'module' in package.json).
Use: import { compile } from 'tiny-graphql-query-compiler' (not import compile from ...).No dependency data recorded yet.