Registry / web-framework / apollo-graphql

apollo-graphql

JSON →
library0.9.7jsnpmunverified

The `apollo-graphql` package, last updated as version 0.9.7 around 2019, served as an internal utility library within the Apollo Server monorepo (primarily during the Apollo Server v2 era). It provided foundational GraphQL-related utilities for schema manipulation, such as adding resolvers, merging schemas, concatenating type definitions, and printing schemas with directives. This package is now considered abandoned, with no further updates planned, and its functionalities have been either integrated directly into newer versions of `@apollo/server` or are handled by more modern, actively maintained libraries like `@graphql-tools/schema` or `@apollo/server` itself. Developers are strongly advised not to use `apollo-graphql` for new projects due to its age, lack of updates, potential security vulnerabilities, and incompatibility with modern `graphql` and Node.js environments.

npm install apollo-graphql
INSTALL
IMPORT
SIG · APOLLO-GRAPHQL
A
apollo-graphql
web-frameworkjavascriptv0.9.7
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

addResolversToSchema
const { addResolversToSchema } = require('apollo-graphql');
import { addResolversToSchema } from 'apollo-graphql';
This package predates widespread ESM adoption and primarily supports CommonJS `require()`. Named imports were available for CJS.
printSchemaWithDirectives
const { printSchemaWithDirectives } = require('apollo-graphql');
import printSchemaWithDirectives from 'apollo-graphql';
Most exports were named. Default imports are not applicable for this package.
mergeSchemas
const { mergeSchemas } = require('apollo-graphql');
import * as ApolloGraphql from 'apollo-graphql';
While `import * as` might technically work in some transpiled environments, the intended and most reliable import pattern for this legacy package is CommonJS `require()`.

Illustrates the historical usage of `addResolversToSchema` from `apollo-graphql` within a CommonJS environment, emphasizing its abandonment and suggesting modern alternatives.

const { gql } = require('apollo-server-express'); const { addResolversToSchema } = require('apollo-graphql'); const { makeExecutableSchema } = require('@graphql-tools/schema'); // This example is for illustrative purposes only, showing historical usage. // It is not recommended for current development. const typeDefs = gql` type Query { hello: String greet(name: String!): String } `; const resolvers = { Query: { hello: () => 'Hello, world!', greet: (parent, { name }) => `Greetings, ${name}!`, }, }; // Create a basic executable schema (using modern @graphql-tools for simplicity here) let schema = makeExecutableSchema({ typeDefs }); // Historically, apollo-graphql's addResolversToSchema would be used. // Note: This function might not be directly compatible with modern `graphql-tools` Schema types. // For a truly historical setup, one would need older `graphql` and `graphql-tools` versions. try { schema = addResolversToSchema(schema, resolvers); console.log('Schema with resolvers added (historical emulation):'); // In a real scenario, you'd then pass this schema to Apollo Server v2 // For demonstration, we'll just log a success message. console.log('Schema successfully augmented using addResolversToSchema.'); console.log(require('graphql').printSchema(schema)); } catch (e) { console.error('Error attempting to use addResolversToSchema. This package is old and likely incompatible:', e.message); } // For current projects, use `@apollo/server` or `@graphql-tools/schema` directly.
Debug
Known issues
breakingThis package is explicitly abandoned and has not received updates since approximately 2019. It is not compatible with modern Node.js versions (e.g., Node.js 14+ ESM), current `graphql` library versions (v16+), or the latest `@apollo/server` releases.
fix
Do not use this package. Migrate to `@apollo/server`, `@apollo/client`, or `@graphql-tools/schema` for equivalent functionalities.
affects: >=1.0.0 (no version 1.0 exists)
gotchaThe package primarily targets CommonJS environments. Attempting to use `import` statements directly will likely result in module resolution errors or runtime failures unless a robust transpilation pipeline (e.g., Babel, Webpack) is specifically configured for such legacy modules.
fix
Ensure you are using `require()` for all imports from `apollo-graphql` in your JavaScript files. For TypeScript, ensure your `tsconfig.json`'s `module` option is set to `CommonJS` or that your bundler handles legacy CJS modules correctly.
affects: >=0.1.0
breakingSecurity vulnerabilities are highly probable due to the package's age and lack of maintenance. Any reported CVEs or discovered weaknesses will not be patched, posing significant risks to applications that still depend on it.
fix
Remove this package from your dependencies and replace its functionality with modern, actively maintained libraries from the Apollo ecosystem or `graphql-tools`.
affects: >=0.1.0
gotchaThe peer dependency on `graphql` specifies versions `^14.2.1 || ^15.0.0`. Installing this package with `graphql` v16 or higher will trigger peer dependency warnings and likely lead to runtime errors due to API changes in the `graphql` library itself.
fix
If absolutely forced to use this package (not recommended), pin your `graphql` dependency to a compatible version (e.g., `^15.0.0`). The ultimate fix is to migrate away from `apollo-graphql`.
affects: >=0.9.7
Errors
Common errors & fixes
TypeError: (0 , apollo_graphql_1.addResolversToSchema) is not a function
Attempting to import `apollo-graphql` using ESM `import` syntax in an environment that doesn't correctly transpile legacy CommonJS modules, or when the `addResolversToSchema` function is not correctly resolved.
fix
Change your import statement to use CommonJS `require()`: `const { addResolversToSchema } = require('apollo-graphql');`.
Cannot find module 'apollo-graphql'
The package `apollo-graphql` is not installed, or your module resolver (e.g., Webpack, Node.js) cannot locate it. This often happens if the package name is misspelled, or if it's not present in `node_modules`.
fix
Ensure the package is installed: `npm install apollo-graphql` or `yarn add apollo-graphql`. Also, verify that your project's module resolution paths are correctly configured.
npm WARN apollo-graphql@0.9.7 requires a peer of graphql@^14.2.1 || ^15.0.0 but none is installed.
You have a version of `graphql` installed that is outside the range specified by `apollo-graphql`'s peer dependencies, or `graphql` is not installed at all.
fix
Install a compatible version of `graphql`, for example: `npm install graphql@^15.0.0`. However, the primary recommendation is to remove `apollo-graphql` entirely due to its abandonment.
Upgrade
Version history
0.9.7latest on npm
Audit
Dependencies
graphqlrequiredPeer dependency for GraphQL schema and type definitions.
Agent activity
26 hits · last 30 days
node
22
OpenAI (training)
1
Resources
apollo-graphql — npm install apollo-graphql · libregistry