Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sysgears/apollo-cache-logger
Apollo Cache Logger
https://github.com/sysgears/apollo-cache-logger
apollo apollo-client graphql
Last synced: 4 days ago
JSON representation
Apollo Cache Logger
- Host: GitHub
- URL: https://github.com/sysgears/apollo-cache-logger
- Owner: sysgears
- License: mit
- Created: 2018-04-19T14:38:17.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-04-30T16:59:16.000Z (over 6 years ago)
- Last Synced: 2024-04-24T19:03:51.848Z (7 months ago)
- Topics: apollo, apollo-client, graphql
- Language: TypeScript
- Size: 16.6 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Apollo Cache Logger
[![npm version](https://badge.fury.io/js/apollo-cache-logger.svg)](https://badge.fury.io/js/apollo-cache-logger)
[![Twitter Follow](https://img.shields.io/twitter/follow/sysgears.svg?style=social)](https://twitter.com/sysgears)## Installation
```bash
npm install --save-dev apollo-cache-logger
```## Usage
``` js
import LogCache from 'apollo-cache-logger';const cache = new LogCache(new InMemoryCache(), { logger: msg => console.log(msg) });
```Sample output:
``` js
read(query CounterState {
counterState @client {
counter
}
}) -> {"counterState":{"counter":1,"__typename":"CounterState"}}
diff(query CounterState {
counterState @client {
counter
__typename
}
}) -> {"result":{"counterState":{"counter":1,"__typename":"CounterState"}},"complete":true}
read(query counterQuery {
counter {
amount
}
}) -> {"counter":{"amount":19,"__typename":"Counter"}}
```
### Routing
If you want to manage several Apollo Caches separately and route between them on a GraphQL document-basis please check [`apollo-cache-router`](https://github.com/sysgears/apollo-cache-router)## License
Copyright © 2018 [SysGears LTD]. This source code is licensed under the [MIT] license.[MIT]: LICENSE
[SysGears LTD]: http://sysgears.com