diana/
lib.rs

1#![forbid(unsafe_code)]
2#![deny(missing_docs)]
3
4/*!
5Diana is an out-of-the-box fully-fledged GraphQL system with inbuilt support for commonly-used features like subscriptions and authentication.
6It was built to allow a simple but fully-featured GraphQL system to be very quickly created for systems that have complex data structures
7and no time for boilerplate.
8
9Diana builds on the fantastic work of [async_graphql](https://crates.io/crates/async_graphql) to provide an architecture that allows you
10to run queries and mutations **serverlessly**, with subscriptions running on serverful infrastructure. To achieve this, Diana uses an
11integrations system, whereby the core [`DianaHandler`] logic is used to create high-level wrappers for common deployment systems like
12Actix Web and AWS Lambda (including its derivatives, like Netlify). The communication between the serverless and serverful systems is done
13for you, exposing a simple, automatically authenticated publishing API.
14
15In development, Diana supports setting up one server for queries/mutations and another for subscriptions. When it comes time to go serverless,
16you just change one file!
17
18This documentation does not contain examples, which can be found in the [GitHub repository](https://github.com/arctic-hen7/diana). More
19detailed explanations and tutorials can be found in the [book](https://arctic-hen7.github.io/diana).
20*/
21
22mod auth;
23mod diana_handler;
24/// The module for errors and results. This uses [error_chain] behind the scenes.
25/// You'll also find [`GQLResult`](crate::errors::GQLResult) and [`GQLError`](crate::errors::Error) in here, which may be useful in working
26/// with your own resolvers.
27pub mod errors;
28mod graphql;
29/// The module for utility functions for schema development.
30pub mod graphql_utils;
31mod options;
32mod pubsub;
33
34// Public exports accessible from the root (everything the user will need)
35pub use crate::auth::auth_state::{AuthState, AuthToken};
36pub use crate::auth::core::{AuthBlockLevel, AuthVerdict};
37pub use crate::auth::jwt::{
38    create_jwt, decode_time_str, get_jwt_secret, validate_and_decode_jwt, Claims, JWTSecret,
39};
40pub use crate::diana_handler::{DianaHandler, DianaResponse, SysSchema};
41pub use crate::options::{Options, OptionsBuilder};
42pub use crate::pubsub::Publisher;
43
44// Users shouldn't have to install `async_graphql` themselves for basic usage
45#[doc(no_inline)]
46pub use async_graphql;
47// Other stuff users shouldn't have to install for basic use
48#[doc(no_inline)]
49pub use async_stream::stream; // The `stream!` macro
50#[doc(no_inline)]
51pub use tokio_stream::{Stream, StreamExt}; // For subscriptions