1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! This is a normalized cache exchange for the [`artemis`](../artemis/index.html) GraphQL Client.
//! This is a drop-in replacement for the default [`CacheExchange`] that, instead of document
//! caching, caches normalized data by keys and connections between data.
//!
//! `artemis` is already quite a comprehensive GraphQL client. However in several cases it may be
//! desirable to have data update across the entirety of an app when a response updates some known
//! pieces of data.
//!
//! # Quick Start
//!
//! After installing this crate, change the default `artemis` Client like from something like this:
//!
//! ```
//! let client = artemis::ClientBuilder::new("http://0.0.0.0")
//!     .with_default_exchanges()
//!     .build();
//! ```
//!
//! to this
//!
//! ```
//! use artemis::default_exchanges::{FetchExchange, DedupExchange};
//! use artemis_normalized_cache::NormalizedCacheExchange;
//!
//! let client = artemis::ClientBuilder::new("http://0.0.0.0")
//!     .with_exchange(FetchExchange)
//!     .with_exchange(NormalizedCacheExchange::new())
//!     .with_exchange(DedupExchange)
//!     .build();
//! ```
//!
//! TODO: Don't steal urlq's docs you plagiarist

#![allow(unused_parens)]
#![cfg_attr(test, feature(proc_macro_hygiene))]

#[macro_use]
extern crate async_trait;

#[cfg(test)]
#[macro_use]
extern crate lazy_static;

pub mod cache_exchange;
mod store;
mod types;

pub use cache_exchange::NormalizedCacheExchange;
use fnv::FnvBuildHasher;
pub use store::QueryStore;
#[doc(hidden)]
pub use store::Store;
pub use types::{NormalizedCacheExtension, NormalizedCacheOptions};

pub type HashSet<V> = std::collections::HashSet<V, FnvBuildHasher>;
pub type Dependencies = HashSet<String>;