{"id":13727073,"url":"https://github.com/timkendall/tql","last_synced_at":"2025-10-20T17:20:13.278Z","repository":{"id":38399187,"uuid":"321434112","full_name":"timkendall/tql","owner":"timkendall","description":"A GraphQL query builder for TypeScript. Avoid the pain of codegen.","archived":true,"fork":false,"pushed_at":"2023-07-20T02:44:43.000Z","size":3463,"stargazers_count":131,"open_issues_count":37,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-22T19:11:31.619Z","etag":null,"topics":["dsl","graphql","nodejs","query-builder","typescript"],"latest_commit_sha":null,"homepage":"https://tql.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timkendall.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-12-14T18:14:04.000Z","updated_at":"2024-12-19T13:55:14.000Z","dependencies_parsed_at":"2024-01-06T07:54:21.744Z","dependency_job_id":"3227451f-308a-4844-8655-983c8efb1601","html_url":"https://github.com/timkendall/tql","commit_stats":{"total_commits":162,"total_committers":6,"mean_commits":27.0,"dds":0.191358024691358,"last_synced_commit":"a3f77f25b212a7ab6d971f8831d46e4e1af151d5"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkendall%2Ftql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkendall%2Ftql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkendall%2Ftql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkendall%2Ftql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timkendall","download_url":"https://codeload.github.com/timkendall/tql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252965211,"owners_count":21832839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dsl","graphql","nodejs","query-builder","typescript"],"created_at":"2024-08-03T01:03:38.387Z","updated_at":"2025-10-20T17:20:12.888Z","avatar_url":"https://github.com/timkendall.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003e **Warning**:\n\u003e This library will not be recieving updates any time soon.\n\n\n\u003e 🙏 Thank you to all contributors. I am not interested in maintaining this right now but please feel free to fork and take inspiration from!\n\n\n# TQL\n\n**tql** is a TypeScript GraphQL query builder.\n\n- 🔒 **Fully Type-safe** - Operation results and variables are fully type-safe thanks to TypeScript's advanced type-system.\n- 🔌 **Backendless**: - Integrate with any GraphQL client to execute queries.\n- 🔮 **Automatic Variables**: - Variable definitions are automatically derived based on usage.\n- 📝 **Inline Documentation**: JSDoc comments provide descriptions and deprecation warnings for fields directly in your editor.\n- ⚡ **Single Dependency**: [`graphql-js`](https://github.com/graphql/graphql-js) is our single runtime (peer) dependency.\n\n## [Try it Out](https://codesandbox.io/s/tql-starwars-wlfg9?file=/src/index.ts\u0026runonclick=1)\n\nTry out our pre-compiled Star Wars GraphQL SDK on [CodeSandbox](https://codesandbox.io/s/tql-starwars-wlfg9?file=/src/index.ts\u0026runonclick=1)!\n\n## Installation\n\n1. `npm install @timkendall/tql@beta`\n\n   * **TypeScript 4.1+** is required for [Recursive Conditional Type](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/#recursive-conditional-types) support\n\n2. Generate an SDK with `npx @timkendall/tql-gen \u003cschema\u003e -o sdk.ts`\n\n  `\u003cschema\u003e` can be a path to local file or an http endpoint url.\n\n## Usage\n\nImport selector functions to start defining queries 🎉\n\n```typescript\nimport { useQuery } from '@apollo/client'\n\n// SDK generated in previous setup\nimport { character, query, $ } from './starwars'\n\n// define reusable selections\nconst CHARACTER = character(t =\u003e [\n  t.id(),\n  t.name(),\n  t.appearsIn(),\n])\n\nconst QUERY = query((t) =\u003e [\n  t.reviews({ episode: Episode.EMPIRE }, (t) =\u003e [\n    t.stars(),\n    t.commentary(),\n  ]),\n\n  t.human({ id: $('id') }, (t) =\u003e [\n    t.__typename(),\n    t.id(),\n    t.name(),\n    t.appearsIn(),\n    t.homePlanet(),\n\n    // deprecated field should be properly picked-up by your editor\n    t.mass(),\n\n    t.friends((t) =\u003e \u003cconst\u003e[\n      t.__typename(),\n      \n      ...CHARACTER,\n      // or\n      CHARACTER.toInlineFragment(),\n\n      t.on(\"Human\", (t) =\u003e [t.homePlanet()]),\n      t.on(\"Droid\", (t) =\u003e [t.primaryFunction()]),\n    ]),\n\n    t.starships((t) =\u003e [t.id(), t.name()]),\n  ]),\n]).toQuery({ name: 'Example' })\n\n// type-safe result and variables 👍\nconst { data } = useQuery(QUERY, { variables: { id: '1011' }})\n\n```\n\n## Inspiration\n\nI was inspired by the features and DSL's of [graphql-nexus](https://github.com/graphql-nexus/schema), [graphql_ppx](https://github.com/mhallin/graphql_ppx), [gqless](https://github.com/gqless/gqless), and [caliban](https://github.com/ghostdogpr/caliban).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimkendall%2Ftql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimkendall%2Ftql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimkendall%2Ftql/lists"}