https://github.com/digithun/graphql-compose-recompose
Utility that wrap GraphQL compose to high order functional pattern
https://github.com/digithun/graphql-compose-recompose
graphql graphql-compose recompose
Last synced: 6 months ago
JSON representation
Utility that wrap GraphQL compose to high order functional pattern
- Host: GitHub
- URL: https://github.com/digithun/graphql-compose-recompose
- Owner: digithun
- License: mit
- Created: 2017-03-16T08:21:24.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-15T16:10:34.000Z (about 9 years ago)
- Last Synced: 2025-10-19T09:49:46.296Z (8 months ago)
- Topics: graphql, graphql-compose, recompose
- Language: JavaScript
- Size: 86.9 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Caution working process...
## GraphQL Compose Recompose
This library help your life easier by create composing function that workwith GraphQL compose
Also with Typescript
> Inspire by React utility lib [Recompose](https://github.com/acdlite/recompose)
## Installation
```bash
$ npm install graphql-compose graphql graphql-compose-recompose
```
## Example
### From
```js
UserTC.addFields({
friend: {
type: GraphQLString,
resolve: () => 'Alan'
}
});
UserTC.extendField('friend',{
description: 'Get his friend'
});
exports.TC = UserTC
```
### To
```js
const { compose, addRelation } = require('graphql-compose-recompose');
exports.TC = compose(
addFields(
'friends',{
type: GraphQLString,
resolve: () => 'Alan'
})
extendField(
'friend',{
description: 'Get his friend'
})
)(UserTC);
```
# API
## Typecomposer
```js
compose(
setFields({
foobar: {
type: GraphQLString
}
}),
addFields({
foo: {
type: GraphQLString
}
}),
// and more
// removeField
// removeOtherFields
// reorderFields
// deprecateFields
// extendField
// addResolver
// removeResolver
// setTypeName
// setDescription
)(type)
```
## TODO
- [x] Wraping Typecomposer api
- [ ] Wraping InputTypecomposer api
- [ ] Wraping Resolver api
- [ ] Add real life example
- [ ] Unit test
- [x] Type definition
- [x] Use Commitizen
- [ ] Add CI Build
- [ ] Coverage