Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apollo-cache-router

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-cache-router - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

28

lib/bundle.umd.js

@@ -29,30 +29,34 @@ (function (global, factory) {

OverrideCache.prototype.read = function (query) {
return this.options.read ? this.options.read(query) : this.cache.read(query);
return this.options.hasOwnProperty('read') ? this.options.read(query) : this.cache.read(query);
};
OverrideCache.prototype.write = function (write) {
this.options.write ? this.options.write(write) : this.cache.write(write);
this.options.hasOwnProperty('write') ? this.options.write(write) : this.cache.write(write);
};
OverrideCache.prototype.diff = function (query) {
return this.options.diff ? this.options.diff(query) : this.cache.diff(query);
return this.options.hasOwnProperty('diff') ? this.options.diff(query) : this.cache.diff(query);
};
OverrideCache.prototype.watch = function (watch) {
return this.options.watch ? this.options.watch(watch) : this.cache.watch(watch);
return this.options.hasOwnProperty('watch') ? this.options.watch(watch) : this.cache.watch(watch);
};
OverrideCache.prototype.evict = function (query) {
return this.options.evict ? this.options.evict(query) : this.cache.evict(query);
return this.options.hasOwnProperty('evict') ? this.options.evict(query) : this.cache.evict(query);
};
OverrideCache.prototype.reset = function () {
return this.options.reset ? this.options.reset() : this.cache.reset();
return this.options.hasOwnProperty('reset') ? this.options.reset() : this.cache.reset();
};
OverrideCache.prototype.restore = function (serializedState) {
return this.options.restore ? this.options.restore(serializedState) : this.cache.restore(serializedState);
return this.options.hasOwnProperty('restore')
? this.options.restore(serializedState)
: this.cache.restore(serializedState);
};
OverrideCache.prototype.extract = function (optimistic) {
return this.options.extract ? this.options.extract(optimistic) : this.cache.extract(optimistic);
return this.options.hasOwnProperty('extract') ? this.options.extract(optimistic) : this.cache.extract(optimistic);
};
OverrideCache.prototype.removeOptimistic = function (id) {
this.options.removeOptimistic ? this.options.removeOptimistic(id) : this.cache.removeOptimistic(id);
this.options.hasOwnProperty('removeOptimistic')
? this.options.removeOptimistic(id)
: this.cache.removeOptimistic(id);
};
OverrideCache.prototype.performTransaction = function (transaction) {
this.options.performTransaction
this.options.hasOwnProperty('performTransaction')
? this.options.performTransaction(transaction)

@@ -62,3 +66,3 @@ : this.cache.performTransaction(transaction);

OverrideCache.prototype.recordOptimisticTransaction = function (transaction, id) {
this.options.recordOptimisticTransaction
this.options.hasOwnProperty('recordOptimisticTransaction')
? this.options.recordOptimisticTransaction(transaction, id)

@@ -68,3 +72,3 @@ : this.cache.recordOptimisticTransaction(transaction, id);

OverrideCache.prototype.transformDocument = function (document) {
return this.options.transformDocument
return this.options.hasOwnProperty('transformDocument')
? this.options.transformDocument(document)

@@ -71,0 +75,0 @@ : this.cache.transformDocument(document);

@@ -23,30 +23,34 @@ "use strict";

OverrideCache.prototype.read = function (query) {
return this.options.read ? this.options.read(query) : this.cache.read(query);
return this.options.hasOwnProperty('read') ? this.options.read(query) : this.cache.read(query);
};
OverrideCache.prototype.write = function (write) {
this.options.write ? this.options.write(write) : this.cache.write(write);
this.options.hasOwnProperty('write') ? this.options.write(write) : this.cache.write(write);
};
OverrideCache.prototype.diff = function (query) {
return this.options.diff ? this.options.diff(query) : this.cache.diff(query);
return this.options.hasOwnProperty('diff') ? this.options.diff(query) : this.cache.diff(query);
};
OverrideCache.prototype.watch = function (watch) {
return this.options.watch ? this.options.watch(watch) : this.cache.watch(watch);
return this.options.hasOwnProperty('watch') ? this.options.watch(watch) : this.cache.watch(watch);
};
OverrideCache.prototype.evict = function (query) {
return this.options.evict ? this.options.evict(query) : this.cache.evict(query);
return this.options.hasOwnProperty('evict') ? this.options.evict(query) : this.cache.evict(query);
};
OverrideCache.prototype.reset = function () {
return this.options.reset ? this.options.reset() : this.cache.reset();
return this.options.hasOwnProperty('reset') ? this.options.reset() : this.cache.reset();
};
OverrideCache.prototype.restore = function (serializedState) {
return this.options.restore ? this.options.restore(serializedState) : this.cache.restore(serializedState);
return this.options.hasOwnProperty('restore')
? this.options.restore(serializedState)
: this.cache.restore(serializedState);
};
OverrideCache.prototype.extract = function (optimistic) {
return this.options.extract ? this.options.extract(optimistic) : this.cache.extract(optimistic);
return this.options.hasOwnProperty('extract') ? this.options.extract(optimistic) : this.cache.extract(optimistic);
};
OverrideCache.prototype.removeOptimistic = function (id) {
this.options.removeOptimistic ? this.options.removeOptimistic(id) : this.cache.removeOptimistic(id);
this.options.hasOwnProperty('removeOptimistic')
? this.options.removeOptimistic(id)
: this.cache.removeOptimistic(id);
};
OverrideCache.prototype.performTransaction = function (transaction) {
this.options.performTransaction
this.options.hasOwnProperty('performTransaction')
? this.options.performTransaction(transaction)

@@ -56,3 +60,3 @@ : this.cache.performTransaction(transaction);

OverrideCache.prototype.recordOptimisticTransaction = function (transaction, id) {
this.options.recordOptimisticTransaction
this.options.hasOwnProperty('recordOptimisticTransaction')
? this.options.recordOptimisticTransaction(transaction, id)

@@ -62,3 +66,3 @@ : this.cache.recordOptimisticTransaction(transaction, id);

OverrideCache.prototype.transformDocument = function (document) {
return this.options.transformDocument
return this.options.hasOwnProperty('transformDocument')
? this.options.transformDocument(document)

@@ -65,0 +69,0 @@ : this.cache.transformDocument(document);

{
"name": "apollo-cache-router",
"version": "1.1.0",
"version": "1.1.1",
"description": "Apollo Cache Router",

@@ -5,0 +5,0 @@ "main": "./lib/bundle.umd.js",

@@ -14,2 +14,6 @@ ## Apollo Cache Router

``` js
import { InMemoryCache } from 'apollo-cache-inmemory';
import ApolloCacheRouter from 'apollo-cache-router';
import { hasDirectives } from 'apollo-utilities';
const netCache = new InMemoryCache();

@@ -19,3 +23,4 @@ const localCache = new InMemoryCache();

ApolloCacheRouter.route([netCache, localCache], document => {
if (hasDirectives(['client'], document) || getOperationAST(document).name.value === 'GeneratedClientQuery') {
if (hasDirectives(['client'], document)
|| getOperationAST(document).name.value === 'GeneratedClientQuery') {
// Pass all @client queries and @client defaults to localCache

@@ -37,2 +42,5 @@ return [localCache];

### Logging
If you want log cache access and errors please check [`apollo-cache-logger`](https://github.com/sysgears/apollo-cache-logger)
## License

@@ -39,0 +47,0 @@ Copyright © 2018 [SysGears LTD]. This source code is licensed under the [MIT] license.

@@ -30,39 +30,43 @@ import { ApolloCache, Cache, Transaction } from 'apollo-cache';

public read<T>(query: Cache.ReadOptions): T {
return this.options.read ? this.options.read(query) : this.cache.read(query);
return this.options.hasOwnProperty('read') ? this.options.read(query) : this.cache.read(query);
}
public write(write: Cache.WriteOptions): void {
this.options.write ? this.options.write(write) : this.cache.write(write);
this.options.hasOwnProperty('write') ? this.options.write(write) : this.cache.write(write);
}
public diff<T>(query: Cache.DiffOptions): Cache.DiffResult<T> {
return this.options.diff ? this.options.diff(query) : this.cache.diff(query);
return this.options.hasOwnProperty('diff') ? this.options.diff(query) : this.cache.diff(query);
}
public watch(watch: Cache.WatchOptions): () => void {
return this.options.watch ? this.options.watch(watch) : this.cache.watch(watch);
return this.options.hasOwnProperty('watch') ? this.options.watch(watch) : this.cache.watch(watch);
}
public evict(query: Cache.EvictOptions): Cache.EvictionResult {
return this.options.evict ? this.options.evict(query) : this.cache.evict(query);
return this.options.hasOwnProperty('evict') ? this.options.evict(query) : this.cache.evict(query);
}
public reset(): Promise<void> {
return this.options.reset ? this.options.reset() : this.cache.reset();
return this.options.hasOwnProperty('reset') ? this.options.reset() : this.cache.reset();
}
public restore(serializedState: TCache): ApolloCache<TCache> {
return this.options.restore ? this.options.restore(serializedState) : this.cache.restore(serializedState);
return this.options.hasOwnProperty('restore')
? this.options.restore(serializedState)
: this.cache.restore(serializedState);
}
public extract(optimistic: boolean): TCache {
return this.options.extract ? this.options.extract(optimistic) : this.cache.extract(optimistic);
return this.options.hasOwnProperty('extract') ? this.options.extract(optimistic) : this.cache.extract(optimistic);
}
public removeOptimistic(id: string): void {
this.options.removeOptimistic ? this.options.removeOptimistic(id) : this.cache.removeOptimistic(id);
this.options.hasOwnProperty('removeOptimistic')
? this.options.removeOptimistic(id)
: this.cache.removeOptimistic(id);
}
public performTransaction(transaction: Transaction<any>): void {
this.options.performTransaction
this.options.hasOwnProperty('performTransaction')
? this.options.performTransaction(transaction)

@@ -73,3 +77,3 @@ : this.cache.performTransaction(transaction);

public recordOptimisticTransaction(transaction: Transaction<any>, id: string): void {
this.options.recordOptimisticTransaction
this.options.hasOwnProperty('recordOptimisticTransaction')
? this.options.recordOptimisticTransaction(transaction, id)

@@ -80,3 +84,3 @@ : this.cache.recordOptimisticTransaction(transaction, id);

public transformDocument(document: DocumentNode): DocumentNode {
return this.options.transformDocument
return this.options.hasOwnProperty('transformDocument')
? this.options.transformDocument(document)

@@ -83,0 +87,0 @@ : this.cache.transformDocument(document);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc