Registry / storage / apollo-cache-hermes

apollo-cache-hermes

JSON →
library0.8.16jsnpmunverified

An alternative cache implementation for Apollo Client (v0.8.16) optimized for heavy GraphQL payloads. Uses an immutable, normalized graph structure enabling direct references and constant-time reads, contrasting with Apollo's default InMemoryCache which rebuilds results on every read. Currently in early development with limited support for union types and writeData. Part of Apollo Client ecosystem, ships TypeScript types, and requires @apollo/client ^3.1.2 as a peer dependency.

npm install apollo-cache-hermes
INSTALL
IMPORT
SIG · APOLLO-CACHE-HERME
A
apollo-cache-hermes
storagejavascriptv0.8.16
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

Hermes
import { Hermes } from 'apollo-cache-hermes'
import Hermes from 'apollo-cache-hermes'
Named export, not default. The package has no default export.
Hermes
const { Hermes } = require('apollo-cache-hermes')
const Hermes = require('apollo-cache-hermes')
CommonJS must destructure the named export.
CacheContext
import { CacheContext } from 'apollo-cache-hermes'
Available for advanced configuration, but not typically used directly. Documentation refers to source code for options.

Basic setup of Apollo Client with Hermes cache and a sample query using TypeScript.

import { ApolloClient, InMemoryCache } from '@apollo/client'; import { Hermes } from 'apollo-cache-hermes'; const client = new ApolloClient({ uri: 'https://api.example.com/graphql', cache: new Hermes() }); client.query({ query: gql` query GetTodos { todos { id title completed } } ` }).then(result => { console.log(result.data); });
Debug
Known issues
gotchaUnion types are not supported; Hermes treats all __typename values equally.
fix
Avoid relying on type-based cache differentiation or use InMemoryCache if union types are required.
affects: <1.0.0
gotchawriteData is not implemented; use cache.modify or client.writeQuery instead.
fix
Replace writeData calls with writeQuery or cache.modify patterns.
affects: <1.0.0
gotchaThe cache returns direct references with potentially extra fields beyond the query selection set.
fix
Expect extra fields in query results. Consider using data masking or access only known fields.
affects: >=0.0.0
deprecatedConfiguration options may change without major version bump; refer to source code.
fix
Pin to a specific version and test upgrades. Use CacheContext source as documentation.
affects: <1.0.0
Errors
Common errors & fixes
TypeError: Hermes is not a constructor
Using default import instead of named import.
fix
Use import { Hermes } from 'apollo-cache-hermes'
Cannot find module 'apollo-cache-hermes'
Missing installation or wrong import path.
fix
Run npm install apollo-cache-hermes and check the import path is correct.
Upgrade
Version history
0.8.16latest on npm
Audit
Dependencies
@apollo/clientrequiredPeer dependency - required for core Apollo Client integration
Agent activity
40 hits · last 30 days
node
36
Resources
apollo-cache-hermes — npm install apollo-cache-hermes · libregistry