{"id":47944,"library":"graphql-static-binding","title":"graphql-static-binding","description":"graphql-static-binding (v0.9.3, last released 2019) generates static TypeScript binding files from a GraphQL schema, enabling type-safe query construction without runtime schema introspection. It is designed for use with graphql-tools and the static binding pattern popularized by Prisma. The package requires graphql ^0.11.0-0.13.0 and has not seen updates in years; users should consider alternatives like GraphQL Code Generator.","status":"maintenance","version":"0.9.3","language":"javascript","source_language":"en","source_url":"https://github.com/supergraphql/graphql-static-binding","tags":["javascript","graphql","typescript"],"install":[{"cmd":"npm install graphql-static-binding","lang":"bash","label":"npm"},{"cmd":"yarn add graphql-static-binding","lang":"bash","label":"yarn"},{"cmd":"pnpm add graphql-static-binding","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for schema processing","package":"graphql","optional":false}],"imports":[{"note":"ESM default export; CommonJS require also works but is not recommended.","wrong":"const generateBinding = require('graphql-static-binding')","symbol":"default","correct":"import generateBinding from 'graphql-static-binding'"},{"note":"Named export; NOT the default export.","wrong":"import BindingGenerator from 'graphql-static-binding'","symbol":"BindingGenerator","correct":"import { BindingGenerator } from 'graphql-static-binding'"},{"note":"Use 'import type' in TypeScript to avoid runtime inclusion; Binding is a type-only export.","wrong":"import { Binding } from 'graphql-static-binding'","symbol":"types","correct":"import type { Binding } from 'graphql-static-binding'"}],"quickstart":{"code":"import { makeExecutableSchema } from 'graphql-tools';\nimport generateBinding from 'graphql-static-binding';\n\nconst typeDefs = `\n  type Query {\n    user(id: ID!): User\n  }\n  type User {\n    id: ID!\n    name: String\n  }\n`;\n\nconst resolvers = {\n  Query: {\n    user: (_, { id }) => ({ id, name: 'Alice' }),\n  },\n};\n\nconst schema = makeExecutableSchema({ typeDefs, resolvers });\n\nconst binding = generateBinding(schema);\n\n// Now binding.query.user({ id: '1' }) returns a selection set string\nconst query = binding.query.user({ id: '1' }, '{ id name }');\nconsole.log(query);\n// Output: query { user(id: \"1\") { id name } }","lang":"typescript","description":"Generates a static binding object from a schema, allowing type-safe query string construction with arguments and selection set."},"warnings":[{"fix":"Downgrade graphql to ^0.13.0 or use an alternative library like graphql-code-generator.","message":"graphql-static-binding only supports graphql versions 0.11.0 through 0.13.0. Using graphql 14+ will cause errors.","severity":"breaking","affected_versions":">=0.14.0"},{"fix":"Migrate to GraphQL Code Generator or other modern tools.","message":"The package has not been updated since 2019 and relies on outdated graphql-tools APIs.","severity":"deprecated","affected_versions":">=0.9.0"},{"fix":"Re-generate bindings whenever the schema changes.","message":"The generated binding must be used with the same schema version it was generated from; schema mismatches cause runtime errors.","severity":"gotcha","affected_versions":">=0.9.0"},{"fix":"Call generateBinding(schema) without new.","message":"Default export generateBinding returns a function, not a class. Attempting to use 'new generateBinding(schema)' will throw.","severity":"gotcha","affected_versions":">=0.9.0"}],"env_vars":null,"search_vec":"'0.11.0':53 '0.13.0':54 '2019':12 'altern':65 'bind':4,8,16,44 'code':68 'consid':64 'construct':27 'design':34 'enabl':22 'file':17 'generat':13,69 'graphql':2,6,20,39,52,67,71 'graphql-static-bind':1,5 'graphql-tool':38 'introspect':31 'javascript':70 'last':10 'like':66 'packag':50 'pattern':45 'popular':46 'prisma':48 'queri':26 'releas':11 'requir':51 'runtim':29 'safe':25 'schema':21,30 'seen':58 'static':3,7,14,43 'tool':40 'type':24 'type-saf':23 'typescript':15,72 'updat':59 'use':36 'user':62 'v0.9.3':9 'without':28 'year':61","created_at":"2026-06-07T16:54:07.946773+00:00","updated_at":"2026-06-07T16:54:07.946773+00:00","problems":[{"fix":"Install graphql@0.13.0: npm install graphql@0.13.0","cause":"graphql version mismatch; graphql 14+ removed isAbstractType.","error":"TypeError: graphql_1.isAbstractType is not a function"},{"fix":"Ensure schema is built with makeExecutableSchema and contains valid type definitions.","cause":"Schema passed to generateBinding is invalid or incomplete.","error":"Cannot read property 'fields' of undefined"},{"fix":"Use graphql@0.13.0 or switch to an alternative.","cause":"graphql 15+ restructured module paths; graphql-static-binding expects older graphql.","error":"Cannot find module 'graphql/utilities/schemaPrinter'"}],"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/supergraphql/graphql-static-binding#readme","github":"https://github.com/supergraphql/graphql-static-binding","docs":null,"changelog":null,"pypi":null,"npm":"graphql-static-binding","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"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}}