MCPcopy
hub / github.com/graphql-editor/graphql-zeus

github.com/graphql-editor/graphql-zeus @7.2.1 sqlite

repository ↗ · DeepWiki ↗ · release 7.2.1 ↗
226 symbols 575 edges 102 files 3 documented · 1%
README

npm Commitizen friendly npm downloads

Strongly Typed GraphQL from the team at GraphQL Editor

Install

$ npm i -g graphql-zeus
# OR
# yarn global add graphql-zeus

You can also install it locally to a project and then use it as an npm or yarn script command using npx or yarn directly like this:

$ npx zeus schema.graphql ./
# OR
# yarn zeus schema.graphql ./

TypeScript

Zeus is TypeScript native, you can refer to imported types directly from the generated output of the CLI

$ zeus schema.graphql ./

Generate

To generate clients simply run this command:

For NodeJS For React Native
$ zeus schema.graphql ./ --node $ zeus schema.graphql ./

How it works

GraphQL Zeus is the absolute best way to interact with your GraphQL endpoints in a type-safe way. Zeus uses your schema to generate Typescript types and strongly typed clients to unlock the power, efficiency, productivity and safety of Typescript on your GraphQL requests.

GraphQL Syntax ( not type-safe 😢 )

query ($id: String!) {
  usersQuery {
    admin {
      sequenceById(_id: $id) {
        _id
        name
        analytics {
          sentMessages
          sentInvitations
          receivedReplies
          acceptedInvitations
        }
        replies {
          message
          createdAt
          _id
        }
        messages {
          _id
          content
          renderedContent
          sendAfterDays
        }
        tracks {
          _id
          createdAt
          inviteSent
          inviteAccepted
          contact {
            linkedInId
          }
        }
      }
    }
  }
}

Zeus syntax ( type-safe 😋 )

{
  usersQuery: {
    admin: {
      sequenceById: [
        { id: $("id", "String!") },
        {
          _id: true,
          name: true,
          analytics: { ...fields("SequenceAnalytics") },
          replies: {
            ...fields("SequenceTrackReply"),
          },
          messages: {
            ...fields("Message"),
          },
          tracks: {
            ...fields("SequenceTrack"),
            contact: {
              linkedInId: true,
            },
          },
        },
      ],
    },
  },
}

New! Composables

import {
  Gql,
  ComposableSelector,
} from './zeus/index.js';

const withComposable = <T extends ComposableSelector<'Card'>, Z extends T>(id: string, rest: Z | T) =>
  Gql('query')({
    cardById: [{ cardId: id }, rest],
  });
  const c1result = await withComposable('12', {
    id: true,
  });
  const c2result = await withComposable('12', {
    Defense: true,
    Attack: true,
  });

Both responses and inputs are safely typed

Features

⚡️ Validates queries and selectors ⚡️ Types mapped from your schema

⚡️ Fetch all primitive fields with one function

⚡️ Works with Apollo Client, React Query, Stucco Subscriptions (*more coming soon...)

⚡️ Works with Subscriptions

⚡️ Infer complex response types

⚡️ Create reusable selection sets (like fragments) for use across multiple queries

⚡️ Supports GraphQL Unions, Interfaces, Aliases and Variables

⚡️ Handles massive schemas

⚡️ Supports Browsers, Node.js and React Native in Javascript and Typescript

⚡️ Schema downloader

⚡️ JSON schema generation

Full documentation

Our full documentation has all the use cases of:

  • scalars
  • selectors

and much more...

Full documentation is available here

Join the Zeus Community and Spread the Word

⚡️ Join the Discussion forum on Dicord 📣

⚡️ Leave a GitHub star ⭐️ 👆

⚡️ Spread the word on your socials and with your networks! 🗣

Contribute

For a complete guide to contributing to GraphQL Zeus, see the Contribution Guide.

  1. Fork this repo
  2. Create your feature branch: git checkout -b feature-name
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

License

MIT 🕊

Extension points exported contracts — how you extend this code

Yargs (Interface)
* basic yargs interface
packages/graphql-zeus/CLIClass.ts
TranslateOptions (Interface)
(no doc)
packages/graphql-zeus-core/TranslateGraphQL/index.ts
GraphQLResponse (Interface)
(no doc)
examples/typescript-node/zeus/index.ts
CliArgs (Interface)
* Interface for yargs arguments
packages/graphql-zeus/CLIClass.ts
OperationName (Interface)
(no doc)
packages/graphql-zeus-core/TreeToTS/index.ts
GraphQLResponse (Interface)
(no doc)
examples/typescript-node/src/zeus/index.ts
ResolvedOperations (Interface)
(no doc)
packages/graphql-zeus-core/TreeToTS/index.ts
OperationDetails (Interface)
(no doc)
packages/graphql-zeus-core/TreeToTS/index.ts

Core symbols most depended-on inside this repo

parse
called by 16
packages/graphql-zeus-jsonschema/TreeToJSONSchema/index.ts
plusDescription
called by 15
packages/graphql-zeus-core/TreeToTS/templates/shared/description.ts
toTypeScriptPrimitive
called by 9
packages/graphql-zeus-core/TreeToTS/templates/shared/primitive.ts
resolveFieldType
called by 7
packages/graphql-zeus-core/TreeToTS/templates/shared/field.ts
InternalsBuildQuery
called by 7
packages/graphql-zeus-core/TreeToTS/functions/new/buildQuery.ts
resolveValueFieldType
called by 6
packages/graphql-zeus-core/TreeToTS/templates/valueTypes/arg.ts
purifyGraphQLKey
called by 6
packages/graphql-zeus-core/TreeToTS/functions/new/purifyGraphQLKey.ts
decodeScalarsInResponse
called by 6
packages/graphql-zeus-core/TreeToTS/functions/new/decodeScalarsInResponse.ts

Shape

Function 182
Class 16
Interface 13
Method 12
Enum 3

Languages

TypeScript100%

Modules by API surface

examples/typescript-node/zeus/index.ts38 symbols
examples/typescript-node/src/zeus/index.ts37 symbols
packages/graphql-zeus-core/TreeToTS/index.ts11 symbols
packages/graphql-zeus-core/TreeToTS/functions/new/clientFunctions.ts11 symbols
packages/graphql-zeus-core/TreeToTS/functions/apiSubscription/graphql-ws.ts8 symbols
packages/graphql-zeus-core/TreeToTS/templates/valueTypes/arg.ts7 symbols
packages/graphql-zeus-core/TreeToTS/functions/new/resolvePath.ts7 symbols
packages/graphql-zeus-jsonschema/TreeToJSONSchema/index.ts6 symbols
packages/graphql-zeus-core/TreeToTS/templates/valueTypes/inputTypes/arg.ts6 symbols
packages/graphql-zeus/CLIClass.ts5 symbols
packages/graphql-zeus-core/TreeToTS/functions/new/models.ts5 symbols
packages/graphql-zeus-core/TreeToTS/templates/valueTypes/inputTypes/index.ts4 symbols

Dependencies from manifests, versioned

@apollo/client3.4.16 · 1×
@commitlint/cli8.3.5 · 1×
@commitlint/config-conventional8.3.4 · 1×
@eslint/eslintrc3.3.1 · 1×
@eslint/js9.39.1 · 1×
@graphql-typed-document-node/core3.1.1 · 1×
@playwright/test1.56.1 · 1×
@tailwindcss/vite4.1.17 · 1×
@types/graphql14.5.0 · 1×
@types/jest29.1.2 · 1×
@types/node22.10.3 · 1×

For agents

$ claude mcp add graphql-zeus \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact