Domain Schema
Domain Schema is a set of packages that let you design your application using Domain Driven Design Principles. You create your schemas with any fields your application needs. Then use them as a single source of truth in the application to generate database schemas, forms, GraphQL types, etc. Domain Schema set of packages try to help you with this task, not stay on your way, by imposing minimal limitations on the shape of your domain schemas, not the fields and the meaning you can use.
Example Domain Schema using ES6 syntax:
__ = name: 'AuthCertificate' ; serial = type: String unique: true ; __ = name: 'AuthFacebook' ; fbId = type: String unique: true ; displayName = type: String optional: true ; __ = name: 'UserProfile' ; firstName = type: String optional: true ; lastName = type: String optional: true ; fullName = type: String optional: true transient: true ; notes = String; __ = name: 'UserAuth' transient: true ; certificate = type: AuthCertificate optional: true ; facebook = type: AuthFacebook optional: true ; const User = __ = name: 'User' ; id = DomainSchemaInteger; username = type: String unique: true ; email = type: String unique: true ; password = type: String private: true ; role = type: String default: 'user' ; isActive = type: Boolean default: false optional: true ; auth = type: UserAuth optional: true ; profile = type: UserProfile optional: true ; ;
Example cyclic Domain Schema definition
__ = name: 'Product' ; id = DomainSchemaInteger; name = String; category = Category; __ = name: 'Category' ; public id = DomainSchemaInteger; name = String; products = Product; const ProductSchema = Product;
Such cyclic dependencies must be contained in one file.
Installation
npm install -g domain-schema
License
Copyright © 2017 SysGears INC. This source code is licensed under the MIT license.