
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
apollo-link-local-cache
Advanced tools
Apollo Link that facilitates locally storing query results
An Apollo Link that facilitates locally storing query results via interception of responses.
yarn add apollo-link-local-cache
import { LocalCacheLink } from 'apollo-link-local-cache'
const link = new LocalCacheLink()
LocalCacheLink takes an object with the following options to allow customization of it's behavior:
name | value | default | required |
---|---|---|---|
shouldCache | boolean | Function | true |
generateKey | Function | operation.toKey | false |
storage | Object | Function | localStorage in the browser |
normalize | Function | JSON.stringify | false |
shouldCache
The cache policy. When set to true
defaults to cache all. When set to a callback, will receive the operation as argument, and should return true
or false
. Defaults to true
.
generateKey
A callback to generate a key for an operation. Defaults to using operation.toKey
.
storage
The Storage in use. Will default to window.localStorage when available. Can also be a callback, in which case it will be called with the current operation
and should retrieve a valid storage.
normalize
Normalization callback, which receives the operation
. Executed prior to storing a query result.
denormalize
Denormalization callback, which receives the operation
. Executed after retrieving a cached query result from the store.
hasLocalDirective
A special shouldCache
implementation is available for enabling caching of queries which use the @local
directive. Use it as follows:
import {
LocalCacheLink,
hasLocalDirective as shouldCache,
} from 'apollo-link-local-cache'
const link = new LocalCacheLink({ shouldCache })
The LocalCacheLink does not use the context for anything, but customization of the config options will often receive the full operation
, meaning they can achieve their purpose by using the context if necessary.
FAQs
Apollo Link that facilitates locally storing query results
The npm package apollo-link-local-cache receives a total of 2 weekly downloads. As such, apollo-link-local-cache popularity was classified as not popular.
We found that apollo-link-local-cache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.