gatewayapps / cradle Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
./src/lib/PropertyTypes/PropertyType.spec.ts has a linting error on line 20. We need a tslint-ignore comment in there
I'm a big fan of our prettier style from https://github.com/gatewayapps/grayskull. I would like to have prettier and prettier-tslint installed as dev dependencies and our prettier.config.js copied over.
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.
Cradle 0.2 introduced Operations on models. These just define the method signatures available on a model and do not dictate the implementation.
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.
Would be nice to have Intellisense for emitter options. To do that, we need to expose the final emitter options.
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
We should build a library of type mappings in a new package:
@gatewayapps/cradle-type-mappings
Should define mappings like:
{
"typescript": {
"UniqueIdentifier": "string"
}
}
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.
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
Support defining operations (mutations/functions/actions/etc...) on models.
What this means
What this DOES NOT mean
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:
id: integer fun(123) notFun(456)
//Results in:
{
type: 'Integer',
'fun': 123,
'notFun': 456
}
id: integer amazing unique primaryKey
//Results in:
{
type: 'Integer',
amazing: true,
unique: true,
primaryKey: true
}
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.
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.
types:
graphql:
UniqueIdentifier: ObjectID
mongoose:
UniqueIdentifier: ObjectID
Should merge in replacements on top of the type mappings loaded from @gatewayapps/cradle-type-mappings
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.