{"id":47980,"library":"graphql-zeus-core","title":"graphql-zeus-core","description":"Strongly Typed GraphQL client library generated by Zeus CLI (v7.2.1). Provides type-safe GraphQL queries, mutations, and subscriptions with full TypeScript support. Key differentiators: uses schema to generate typed clients, supports variables via $ helper, reusable Selectors, custom fetch via Thunder, and TypedDocumentNode for Apollo/urql. Ships ESM and CommonJS, requires graphql-ws >=5 for subscriptions. Active development with monthly releases.","status":"active","version":"7.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/graphql-editor/graphql-zeus","tags":["javascript","typescript"],"install":[{"cmd":"npm install graphql-zeus-core","lang":"bash","label":"npm"},{"cmd":"yarn add graphql-zeus-core","lang":"bash","label":"yarn"},{"cmd":"pnpm add graphql-zeus-core","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for WebSocket subscriptions; must be installed separately (peer dependency).","package":"graphql-ws","optional":true}],"imports":[{"note":"The generated client lives in a local path (default './zeus'), not the npm package. The package provides the generator CLI.","wrong":"import { Gql } from 'graphql-zeus-core'","symbol":"Gql","correct":"import { Gql } from './zeus'"},{"note":"Thunder is a factory for custom fetch chains; it's exported from the generated './zeus' module.","wrong":"import Thunder from 'graphql-zeus-core'","symbol":"Thunder","correct":"import { Thunder } from './zeus'"},{"note":"Used to create reusable selection sets. Only named export, no default export.","wrong":"","symbol":"Selector","correct":"import { Selector } from './zeus'"},{"note":"The $ helper is for declaring variables with types; it's part of the generated client.","wrong":"import { $ } from 'graphql-zeus-core'","symbol":"$","correct":"import { $ } from './zeus'"},{"note":"typedDocumentNode for Apollo/urql is in a separate generated file.","wrong":"import { typedGql } from './zeus'","symbol":"typedGql","correct":"import { typedGql } from './zeus/typedDocumentNode'"}],"quickstart":{"code":"import { Gql, Thunder, Selector, $ } from './zezerus';\nimport { typedGql } from './zezerus/typedDocumentNode';\n\nconst endpoint = process.env.GRAPHQL_ENDPOINT ?? 'http://localhost:4000/graphql';\n\n// Using Gql (built-in Chain with fetch)\nconst gql = Gql('http://localhost:4000/graphql');\nconst rocket = await gql('query')({\n  rocket: [{ id: 1 }, { name: true, type: true }]\n});\nconsole.log('Rocket:', rocket);\n\n// Using Thunder for custom fetch\nconst thunder = Thunder(async (query) => {\n  const res = await fetch(endpoint, {\n    method: 'POST',\n    headers: { 'Content-Type': 'application/json' },\n    body: JSON.stringify({ query })\n  });\n  const json = await res.json();\n  return json.data;\n});\nconst data = await thunder('query')({ rockets: { name: true } });\nconsole.log('Rockets:', data.rockets);\n\n// With variables\nconst rocketById = await gql('query')({\n  rocket: [{ id: $('id', 'Int!') }, { name: true }]\n}, { variables: { id: 1 } });\n\n// Reusable selector\nconst rocketSelector = Selector('Query')({ rocket: [{ id: $('id', 'Int!') }, { name: true, type: true }] });\ntype RocketQuery = InputType<GraphQLTypes['Query'], typeof rocketSelector>;\nconst result = await gql('query')(rocketSelector, { variables: { id: 2 } });\n\n// typedGql for Apollo\nconst doc = typedGql('query')({ rockets: { name: true } });\n","lang":"typescript","description":"Shows four ways to query GraphQL with Zeus: built-in Gql, custom Thunder, variables via $, reusable Selectors, and typedDocumentNode for Apollo clients."},"warnings":[{"fix":"Use import { Gql } from './zeus' (adjust path as generated).","message":"Imports must come from the generated './zeus' directory, not from the 'graphql-zeus-core' npm package.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always provide { variables: { varName: value } } as second argument to the query.","message":"Variables declared with $ must also be passed in the variables option object; missing variables cause runtime GraphQL errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Update imports: import { Gql, Selector } from './zeus'.","message":"Version 7 changed the exported names from 'Api' to 'Gql', 'ZeusSelect' to 'Selector', 'Thunder' remains same.","severity":"breaking","affected_versions":">=7.0.0 <7.0.0"},{"fix":"Use Gql Chain or Thunder for automatic execution.","message":"Use of raw 'Zeus' function to generate GQL strings is still supported but not recommended; prefer 'Gql' or 'Thunder' for full type-safety.","severity":"deprecated","affected_versions":">=7.0.0"},{"fix":"npm install graphql-ws.","message":"Subscriptions require graphql-ws peer dependency; not installing it leads to runtime errors when using subscriptions.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use { __typename: true, '...on MyType': { field: true } }.","message":"Interface/union selections must use inline fragment syntax with string keys like '...on Type', not the spread operator.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'5':58 'activ':61 'apollo/urql':49 'cli':13 'client':8,35 'commonj':53 'core':4 'custom':42 'develop':62 'differenti':29 'esm':51 'fetch':43 'full':25 'generat':10,33 'graphql':2,7,19,56 'graphql-w':55 'graphql-zeus-cor':1 'helper':39 'javascript':66 'key':28 'librari':9 'month':64 'mutat':21 'provid':15 'queri':20 'releas':65 'requir':54 'reusabl':40 'safe':18 'schema':31 'selector':41 'ship':50 'strong':5 'subscript':23,60 'support':27,36 'thunder':45 'type':6,17,34 'type-saf':16 'typeddocumentnod':47 'typescript':26,67 'use':30 'v7.2.1':14 'variabl':37 'via':38,44 'ws':57 'zeus':3,12","created_at":"2026-06-07T16:54:19.224914+00:00","updated_at":"2026-06-07T16:54:19.224914+00:00","problems":[{"fix":"Run the Zeus CLI to generate the client: npx zeus https://your-schema-url ./zeus --typescript. Then import from that path.","cause":"Generated client not created or import path incorrect.","error":"Cannot find module './zeus' or its corresponding type declarations."},{"fix":"Check generated exports; use import { Gql } from './zeus' and ensure CLI version >=7.","cause":"Using older syntax (Gql renamed in v7) or import path points to wrong file.","error":"Property 'Gql' does not exist on type 'typeof import(\"./zeus\")'."},{"fix":"Add second argument: Gql('query')(queryObject, { variables: { key: value } }).","cause":"When using variables you omitted the variables option object.","error":"Expected 2 arguments, but got 1."},{"fix":"Ensure all declared non-null variables are provided with a valid value.","cause":"Passed null to a non-null variable (declared with !) or omitted variable entirely.","error":"Variable \"$id\" got invalid value null."},{"fix":"Use the exact response shape as returned; avoid destructuring aliased fields without the alias name.","cause":"Response data structure may be nested; accessing a field that wasn't requested or is aliased.","error":"Cannot read properties of undefined (reading 'rocket')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/graphql-editor/graphql-zeus#readme","github":"https://github.com/graphql-editor/graphql-zeus","docs":null,"changelog":null,"pypi":null,"npm":"graphql-zeus-core","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}