Registry / database / crorm
library6.0.0jsnpmunverified

Catch&Release ORM (crorm) is an opinionated React/Redux ORM that reduces boilerplate and simplifies immutable data access. Version 6.0.0 requires Redux with Immutable.js, data in JSONAPI format normalized by jsonapi-normalizer, and a 'data' reducer via combineReducers. It provides a base class for models with findById, all, where, create methods, instance dot access, and lifecycle hooks like onDestroy. Compared to alternatives like normalizr or redux-orm, it is tightly coupled to a specific tech stack (Redux, Immutable.Record, jsonapi-normalizer) and assumes CRUD actions. Maintenance and release cadence are unclear; last release appears to be v6.0.0.

npm install crorm
INSTALL
IMPORT
SIG · CRORM
C
crorm
databasejavascriptv6.0.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.

ORM
import { ORM } from 'crorm'
import ORM from 'crorm'
ORM is a named export, not a default export.
Base
import { Base } from 'crorm'
const { Base } = require('crorm')
CommonJS require is also valid but ESM is preferred. Base is a named export.
Config
import { ORM } from 'crorm'; ORM.Config.debug = true;
import { Config } from 'crorm'; Config.debug = true;
Config is not exported directly; it's a property of the ORM namespace object.

Shows how to configure the ORM with a Redux store, define a model, and fetch an entity by ID.

import { ORM } from 'crorm'; import { createStore, combineReducers } from 'redux'; import { Map, Record } from 'immutable'; // Redux store with 'data' reducer const dataReducer = (state = Map(), action) => state; const store = createStore(combineReducers({ data: dataReducer })); // Configure ORM ORM.Config.database = store; ORM.Config.debug = true; // Define a Hero model class Hero extends ORM.Base { static recordType() { return 'hero'; } } // Use the ORM (assumes data is in redux store) const hero = Hero.findById(1); console.log(hero);
Debug
Known issues
breakingRequires Redux store with 'data' reducer key; otherwise ORM fails to find entities.
fix
Ensure your combined reducers have { data: dataReducer }.
affects: >=6.0.0
breakingData must be normalized using jsonapi-normalizer and stored as Immutable.Records.
fix
Normalize your JSONAPI payloads before dispatching to Redux and use Immutable.js Records for entities.
affects: >=6.0.0
deprecatedThe 'order()' class method uses server ordering that may be deprecated in future versions.
fix
Use 'ordered()' or manage ordering manually.
affects: >=6.0.0
gotchafindById returns an instance with empty Immutable.Map() when not found, which can cause 'undefined' dot-access errors if not checked.
fix
Use optional chaining or check hero.entity before accessing properties.
affects: >=6.0.0
gotchaClass methods like 'database()' and 'dispatch()' are static on the ORM.Base class, not instance methods.
fix
Call Hero.database(), not hero.database().
affects: >=6.0.0
breakingThe ORM.Config.database must be the Redux store, not just the state; use store, not store.getState().
fix
Set ORM.Config.database = store (the Redux store object).
affects: >=6.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'getIn')
ORM trying to access data in Redux store before it is populated or with wrong structure.
fix
Ensure Redux store has a 'data' key and entities are normalized as Immutable.Map.
Error: ORM has not been configured with a database. Set ORM.Config.database = store.
ORM.Config.database not set before using Base methods.
fix
Set ORM.Config.database = store before calling any findById, all, etc.
Immutable.Record is not defined
Immutable.js library not imported or used correctly.
fix
Install and import 'immutable' (e.g., import { Record } from 'immutable').
Cannot read property 'entity' of undefined
findById returned an instance with empty map, and code assumed entity exists.
fix
Check if hero.entity exists before accessing properties: if(hero.entity) { ... }
Upgrade
Version history
6.0.0latest on npm
Audit
Dependencies
reduxrequiredRequired for store integration and dispatch
immutablerequiredImmutable.js Records are used for data storage
react-reduxoptionalRequired for React binding via connect
Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
1
Resources
packagecrorm
crorm — npm install crorm · libregistry