Git Product home page Git Product logo

cradle's People

Contributors

arusahni avatar danielgary avatar dependabot[bot] avatar johnmurphy01 avatar justinneff avatar mariohoyos92 avatar stickler-ci avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

mariohoyos92

cradle's Issues

Tests for ModelReferenceType

The ModelReferencePropertyType does not have any tests written. Tests should go in src/lib/PropertyTypes/ModelReferencePropertyType.spec.ts. Please reference other *.spec.ts files for conventions.

Add documentation for operations

Cradle 0.2 introduced Operations on models. These just define the method signatures available on a model and do not dictate the implementation.

Adjust references in spec to allow for 1 to N and 1 to 1 relationships

In the cradle spec, we need the ability to create 1 to N and 1 to 1 references between models.

For example, give a User model and a Group and a Territory model. A User has many Groups and a User has one Territory.

User:
  properties:
    _id: uniqueidentifier auto unique
    deleted: boolean delete
    ...
  references:
    groups: multiple of Group
    territory: single of Territory

in the references section, we need to be able to specify:
for 1-n relationship: property: multiple of X where X is the Model
for a 1-1 relationship: property: single of X where X is the Model

The referenced Model will be required to have a unique identifier but the onus will be on the spec creator.

Support for new config

emitterOptions:
  overwrite:
    _default: true
    Tenant: false
    User: false
loader:
  module: @gatewayapps/cradle-spec-loader
  options:
    source: ./.cradle/models/**/*.yml
emitters:
  graphql-schema:
    module: @gatewayapps/cradle-graphql-emitter
    output: '{{meta.Schema}}.{{Name}}'
    options:
      exclude:
        - Tenant
        - User.Properties.passwordHash
        - User.Operations
      overwrite:
        _default: true
        Tenant: false
    after: yarn graphql-codegen

Type Mappings

We should build a library of type mappings in a new package:

@gatewayapps/cradle-type-mappings

Should define mappings like:

{
  "typescript": {
    "UniqueIdentifier": "string"
  }
}

Update README

We should have a good introduction and documentation about what cradle is. It should discuss the spec, but also discuss how external loaders and emitters work.

Should include some sample commands, sample SPEC file, and an example of output. Links to the sql-loader, react-emitter, and template-emitter as well.

Additional tests for Spec Loader

We need further testing around the spec parser. There are a number of tests written, but they don't cover everything. Check out src/lib/SpecPropertyTypeParser.spec.ts

Any additional tests here would be much appreciated

Operations support

Support defining operations (mutations/functions/actions/etc...) on models.

What this means

  • Operations should define what arguments they will take in, and what the operation will return as a result

What this DOES NOT mean

  • Operations should not explicitly define HOW an operation will perform. Only that this operation will exist

Dynamic PropertyType properties

Right now we have different properties available depending on the property types.

For instance, IntegerPropertyType has a min, max, default, and a custom IntegerAutogenerateOptions auto field.

That means we have to handle parsing different properties for different property types.

I propose we move to following these rules for spec properties:

  • Nothing has custom properties, emitters can publish what properties they desire, but the PropertyTypes themselves do not have hard-coded properties on them
  • Any token followed by a parentheses and a value or values would assign the tokens name as a property with those values. Example:
id: integer fun(123) notFun(456)  
//Results in:
{
    type: 'Integer',
    'fun': 123,
   'notFun': 456
}
  • Any token that is not followed by a parentheses receives the value of true. Example:
id: integer amazing unique primaryKey 
//Results in:
{
    type: 'Integer',
    amazing: true,
    unique: true,
    primaryKey: true
}

Tests for ObjectPropertyType

The ObjectPropertyType does not have any tests written. Tests should go in src/lib/PropertyTypes/ObjectPropertyType.spec.ts. Please reference other *.spec.ts files for conventions.

Tests for IntegerPropertyType

The IntegerPropertyType does not have any tests written. Tests should go in src/lib/PropertyTypes/IntegerPropertyType.spec.ts. Please reference other *.spec.ts files for conventions.

Support type mappings in config

types:
graphql:
UniqueIdentifier: ObjectID
mongoose:
UniqueIdentifier: ObjectID

Should merge in replacements on top of the type mappings loaded from @gatewayapps/cradle-type-mappings

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.