hyperlane-plugin-graphql 23.3.1

A zero-external-parser GraphQL over HTTP plugin for the Hyperlane framework featuring a recursive-descent GraphQL query parser, depth and complexity DoS limits, XxHash3_64 query/mutation resolver registries, variable binding, and GraphQL-over-HTTP POST/GET dispatch.
Documentation
/// Default HTTP endpoint path handled by [`GraphqlHook`].
pub const DEFAULT_GRAPHQL_ENDPOINT: &str = "/graphql";

/// Default maximum query nesting depth allowed before rejection (`16`).
pub const DEFAULT_MAX_DEPTH: usize = 16;

/// Default maximum total field selections per operation (`64`).
pub const DEFAULT_MAX_FIELDS: usize = 64;

/// Default maximum query document length in bytes (`64 KiB`).
pub const DEFAULT_MAX_QUERY_BYTES: usize = 64 * 1024;

/// GraphQL JSON response media type.
pub const GRAPHQL_JSON_CONTENT_TYPE: &str = "application/json; charset=utf-8";

/// Query string parameter name for HTTP GET GraphQL queries.
pub(crate) const QUERY_PARAM_KEY: &str = "query";

/// GraphQL keyword for query operations.
pub(crate) const KW_QUERY: &str = "query";

/// GraphQL keyword for mutation operations.
pub(crate) const KW_MUTATION: &str = "mutation";

/// GraphQL boolean literal `true`.
pub(crate) const KW_TRUE: &str = "true";

/// GraphQL boolean literal `false`.
pub(crate) const KW_FALSE: &str = "false";

/// GraphQL null literal.
pub(crate) const KW_NULL: &str = "null";

/// Error message for malformed JSON request body.
pub(crate) const ERR_INVALID_JSON: &str = "invalid GraphQL JSON payload";

/// Error message for missing query text.
pub(crate) const ERR_MISSING_QUERY: &str = "missing GraphQL query string";

/// Error message for HTTP GET attempting a mutation.
pub(crate) const ERR_GET_MUTATION: &str = "mutations are not allowed over HTTP GET";

/// Error message when query exceeds configured max byte length.
pub(crate) const ERR_QUERY_TOO_LARGE: &str = "GraphQL query exceeds maximum byte size";

/// Error message when query exceeds configured max nesting depth.
pub(crate) const ERR_DEPTH_EXCEEDED: &str = "GraphQL query exceeds maximum nesting depth";

/// Error message when query exceeds configured max field complexity.
pub(crate) const ERR_COMPLEXITY_EXCEEDED: &str = "GraphQL query exceeds maximum field count";

/// Error message for unsupported HTTP method on the GraphQL endpoint.
pub(crate) const ERR_METHOD_NOT_ALLOWED: &str =
    "only GET and POST are supported on GraphQL endpoint";

/// Error message for unexpected end of GraphQL value.
pub(crate) const ERR_UNEXPECTED_EOF_VALUE: &str = "unexpected end of GraphQL value";

/// Error message for missing variable identifier after `$`.
pub(crate) const ERR_EXPECTED_VAR_NAME: &str = "expected variable name after '$'";

/// Error message for unterminated GraphQL string literal.
pub(crate) const ERR_UNTERMINATED_STRING: &str = "unterminated string literal in GraphQL query";

/// Error message for missing input object key.
pub(crate) const ERR_EXPECTED_OBJ_KEY: &str = "expected input object key";

/// Error message for missing colon inside input object.
pub(crate) const ERR_EXPECTED_OBJ_COLON: &str = "expected ':' in input object";

/// Error message for invalid number literal.
pub(crate) const ERR_INVALID_NUMBER: &str = "invalid number literal";

/// Error message for invalid floating-point literal.
pub(crate) const ERR_INVALID_FLOAT: &str = "invalid float literal";

/// Error message for non-finite float literal.
pub(crate) const ERR_NON_FINITE_FLOAT: &str = "non-finite float literal";

/// Error message for invalid integer literal.
pub(crate) const ERR_INVALID_INT: &str = "invalid integer literal";

/// Error message for unexpected GraphQL token.
pub(crate) const ERR_UNEXPECTED_TOKEN: &str = "unexpected GraphQL token";

/// Error message for missing opening brace on selection set.
pub(crate) const ERR_EXPECTED_LBRACE: &str = "expected '{' to start selection set";

/// Error message for unclosed selection set.
pub(crate) const ERR_UNCLOSED_SELECTION: &str = "unclosed selection set";

/// Error message for missing field name in selection set.
pub(crate) const ERR_EXPECTED_FIELD_NAME: &str = "expected field name in selection set";

/// Error message for missing field name after alias colon.
pub(crate) const ERR_EXPECTED_ALIAS_TARGET: &str = "expected field name after alias ':'";

/// Error message for missing argument identifier.
pub(crate) const ERR_EXPECTED_ARG_NAME: &str = "expected argument name";

/// Error message for missing colon after argument name.
pub(crate) const ERR_EXPECTED_ARG_COLON: &str = "expected ':' after argument name";

/// Error message for missing operation keyword or brace.
pub(crate) const ERR_EXPECTED_OPERATION: &str = "expected operation keyword or '{'";