Registry / database / cormo-graphql

cormo-graphql

JSON →
library2.3.0jsnpmunverified

Official GraphQL integration package for the CORMO ORM framework (v2.3.0). Provides decorators and utilities to expose CORMO models as GraphQL types and resolve database queries automatically from GraphQL queries. Integrates with apollo-server and express-graphql. Designed for Node.js 22+. Python CORMO is a separate project; this is the TypeScript/Node.js implementation. Release cadence is tied to CORMO monorepo releases, typically quarterly.

npm install cormo-graphql
INSTALL
IMPORT
SIG · CORMO-GRAPHQL
C
cormo-graphql
databasejavascriptv2.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GraphQLObjectModel
import { GraphQLObjectModel } from 'cormo-graphql';
import { GraphQLObjectModel } from 'cormo';
cormo-graphql is a separate package, not part of the main cormo package.
GraphQLField
import { GraphQLField } from 'cormo-graphql';
import { GraphQLField } from 'cormo-graphql/lib/GraphQLField';
Directly import from the package root; don't use internal paths.
graphql query function
import { graphql } from 'graphql';
import { graphql } from 'cormo-graphql';
The graphql function is from the graphql peer dependency, not from cormo-graphql.

Defines a CORMO model with GraphQL decorators and exposes its GraphQL schema.

import { CORMO } from 'cormo'; import { GraphQLObjectModel, GraphQLField } from 'cormo-graphql'; import { buildSchema } from 'graphql'; const db = new CORMO('sqlite3', { database: ':memory:' }); @GraphQLObjectModel() class User extends db.BaseModel { id!: number; @GraphQLField() name!: string; @GraphQLField() email!: string; } async function main() { await db.connect(); // Generate GraphQL schema from model const schema = User.graphQLSchema; // Use schema with Apollo Server etc. console.log('Schema ready'); } main().catch(console.error);
Debug
Known issues
gotchacoromo-graphql only supports decorators, not GraphQL schema definition language (SDL). You cannot use type definitions strings; you must decorate your CORMO models.
fix
Use @GraphQLObjectModel and @GraphQLField decorators on your CORMO model classes.
affects: >=2.0.0
deprecatedThe graphQLSchema property on model classes may be renamed in future versions. Check documentation for updates.
fix
Use the recommended getter method if available; refer to current docs.
affects: >=2.0.0 <3.0.0
breakingIn version 2.0.0, the package was rewritten to use decorators exclusively, dropping support for older style schema generation. Existing SDL-based setups will break.
fix
Migrate from SDL string to decorator-based model definitions as shown in the quickstart.
affects: >=1.0.0 <2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'cormo-graphql'
cormo-graphql is not installed or is missing from node_modules.
fix
Run: npm install cormo-graphql
TypeError: Class extends value undefined is not a constructor or null
CORMO is not properly initialized before using GraphQLObjectModel.
fix
Ensure you create a CORMO instance and set it globally before defining models: const db = new CORMO('sqlite3', { database: ':memory:' }); (db must be defined before model class definitions)
GraphQLError: Unknown type "...". Did you mean...
The model is not correctly decorated or exported to GraphQL.
fix
Verify that the model class has @GraphQLObjectModel() and all relevant fields have @GraphQLField() decorators.
Upgrade
Version history
2.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
Amazon
1
OpenAI (training)
1
Resources
cormo-graphql — npm install cormo-graphql · libregistry