I've made the decision to deprecate this project. Implementing and maintaining a custom ORM is a very complex job and there are far more mature solutions already available on other platforms.
It was a useful learning experience though, and as part of this project I developed the json-to-graphql-query library which has becoome pretty popular on NPM :)
RevJS is a suite of JavaScript modules designed to speed up development of data-driven JS applications.
RevJS allows you to
- Define a relational data model using plain JS classes, and built-in or custom field types
- Define custom validation logic directly in your models
- Easily create a GraphQL API to make your models available over the network
- Quickly build a user interface for the web or mobile, using our React higher-order components
Check out the Client-side Demo App and its source code
Take a look at the Documentation:
We're on our way to v1.0.0, and are keen to get more users and contributors on board. You can see what we're currently working in our Github Projects.
Theres a full set of working examples in the repo but heres a few snippets of code to give you an idea of what RevJS is all about!:
// Define a new Post modelconstPOST_CATEGORIES=[['agriculture','Agriculture'],['music','Music'],['science','Science'],['technology','Technology'],];exportclassPost{
@AutoNumberField({primaryKey: true})id: number;
@SelectField({selection: POST_CATEGORIES})category: string;
@TextField()title: string;
@TextField({multiLine: true})body: string;
@IntegerField({required: false})rating: number;
@BooleanField()published: boolean;constructor(data?: Partial<Post>){Object.assign(this,data);}}// Add the Post model to a ModelManagerexportconstmodelManager=newModelManager();modelManager.registerBackend('default',newInMemoryBackend());modelManager.register(Post);// Create some dataawaitmodelManager.create(newPost({category: 'agriculture',title: 'My First Post',body: 'This is a really cool post made in RevJS!',rating: 5,published: true}));exportconstapi=newModelApiManager(modelManager);api.register(Post,{operations: ['read','create','update','remove']});constschema=api.getGraphQLSchema();router.post('/graphql',graphqlKoa({schema: schema}));<ModelProvidermodelManager={modelManager}><ListViewtitle="Popular Posts"model="Post"fields={['title','category','rating',]}where={{rating: {_gt: 3}}}orderBy={['rating desc']}limit={10}/></ModelProvider><ModelProvidermodelManager={modelManager}><Typographyvariant="display1">Create Post</Typography><DetailViewmodel="Post"><Fieldname="title"/><Fieldname="category"/><Fieldname="body"colspan={12}/><Fieldname="rating"/><Fieldname="published"/><SaveActionlabel="Create Post"/></DetailView></ModelProvider>MIT



