Registry / database / msand-apollo-cache-hermes

msand-apollo-cache-hermes

JSON →
library0.9.12jsnpmunverified

An alternative cache implementation for Apollo Client, currently at version 0.9.12 (stable). It is maintained by Convoy Inc. and optimized for heavy GraphQL payloads by using an immutable normalized graph structure that returns direct references, reducing CPU/memory overhead compared to Apollo's default InMemoryCache. Release cadence is irregular. Key differentiators include constant-time lookups for static queries, but it lacks support for union types and writeData. Requires @apollo/client ^3.10.8.

npm install msand-apollo-cache-hermes
INSTALL
IMPORT
SIG · MSAND-APOLLO-CACHE
M
msand-apollo-cache-hermes
databasejavascriptv0.9.12
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'
const Hermes = require('apollo-cache-hermes')
Package ships TypeScript types; ESM import is the standard pattern. CJS require may not work in all environments.
Hermes (default export)
import Hermes from 'apollo-cache-hermes'
import { Hermes } from 'apollo-cache-hermes'
The package also exposes a default export, but using the named export is the documented pattern.
CacheContext
import { CacheContext } from 'apollo-cache-hermes'
import CacheContext from 'apollo-cache-hermes'
CacheContext is a named export, not default. Used for custom configuration.

Shows how to set up Apollo Client with Hermes cache, including a custom entity ID function and a basic query.

import { ApolloClient, gql } from '@apollo/client'; import { Hermes } from 'apollo-cache-hermes'; const client = new ApolloClient({ uri: 'https://api.example.com/graphql', cache: new Hermes({ // optional: specify entity ID fields, default is 'id' entityId: (data: any) => data.id ?? data._id, }), }); client.query({ query: gql`{ todos { id text } }` }).then(result => console.log(result.data));
Debug
Known issues
gotchaUnion types and type conditions on fragments are not supported; caching may be incorrect.
fix
Avoid using union types or fragments with type conditions, or use Apollo's InMemoryCache instead.
affects: <=0.9.12
gotchawriteData method is not implemented; client.writeData will fail.
fix
Use client.writeQuery or client.writeFragment instead of writeData.
affects: <=0.9.12
breakingConfiguration API is unstable and may change between minor versions without notice.
fix
Check the source for current configuration options; avoid relying on undocumented features.
affects: >=0.8.0 <1.0.0
gotchaCache returns direct references; query results may include extra fields not requested.
fix
Ensure your application code can tolerate additional fields in query results.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Field "__typename" is not defined on type "..."
Union types are not supported; cache cannot resolve __typename correctly.
fix
Remove union types from your schema queries, or switch to InMemoryCache.
TypeError: client.writeData is not a function
writeData is not implemented in Hermes.
fix
Use writeQuery or writeFragment instead of writeData.
Upgrade
Version history
0.9.12latest on npm
Audit
Dependencies
@apollo/clientrequiredPeer dependency required to integrate with Apollo Client v3
Agent activity
7 hits · last 30 days
node
6
Resources
msand-apollo-cache-hermes — npm install msand-apollo-cache-hermes · libregistry