orchid-graphql is a helper library for resolving GraphQL queries directly with Orchid ORM tables and relations (version 1.9.1). It selects only requested fields and relations, supports unlimited nested resolvers, pagination, filters (e.g., date-based, __in), query modifiers, and field result hooks for access control. Released pre-release (not battle-tested), it is a quick adaptation of objection-graphql-resolver. Requires graphql ^16 and orchid-orm ^1.31.5 as peer dependencies. Node.js >=14. Ships TypeScript types, but typings are not fully ready (returns generic Query).
npm install orchid-graphqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Full example setting up Apollo Server with orchid-graphql: defines a Post table, creates GraphQL schema, maps table to resolver with r.graph, and runs server.
Use with caution; test thoroughly in production-like environments.
Cast or use type assertions when needed (e.g., as unknown as YourType).
Use namespace import (import * as r from 'orchid-graphql') or named import (import { graph }).Install peer deps: npm install graphql orchid-orm
Ensure you pass a table instance from orchid-orm, e.g., r.table(db.post).
Run npm install orchid-graphql and ensure project uses ES modules (type: 'module' in package.json or .mjs files).
Use import * as r from 'orchid-graphql' or import { graph } from 'orchid-graphql'.Ensure you call r.graph() and then use the returned object's resolve method: const graph = r.graph({...}); graph.resolve(...).Pass a specific table: r.table(db.post) instead of r.table(db).