/** * @module @arcis/node/middleware/graphql * * GraphQL request guard (sdk-vectors.md tier 1 #21). Wraps the * `inspectGraphqlQuery` sanitizer in an Express middleware that * pulls the query string from the standard places GraphQL servers * expect it (`req.body.query` for POST, `req.query.query` for GET) * and short-circuits with 400 + a structured error when the query * violates any configured limit. * * ```ts * import { graphqlGuard } from '@arcis/node'; * * app.use('/graphql', graphqlGuard({ * maxDepth: 10, * maxLength: 10000, * blockIntrospection: process.env.NODE_ENV === 'production', * })); * ``` * * Order with the rest of Arcis: install AFTER body-parsing * (`express.json()`) so `req.body.query` is populated, BEFORE the * GraphQL handler so the deny path short-circuits resolver work. */ import type { RequestHandler } from 'express'; import { type GraphqlGuardOptions, type GraphqlViolation } from '../sanitizers/graphql'; export interface GraphqlGuardMiddlewareOptions extends GraphqlGuardOptions { /** HTTP status to return on violation. Default: 400 (matches GraphQL spec for parse errors). */ statusCode?: number; /** Custom message template. Default: built per-reason. */ message?: string | ((reason: GraphqlViolation) => string); } export declare function graphqlGuard(options?: GraphqlGuardMiddlewareOptions): RequestHandler; export default graphqlGuard; //# sourceMappingURL=graphql.d.ts.map