Skip to content

Commit 4afe093

Browse files
committed
Update Readme
1 parent 86d07a9 commit 4afe093

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

README.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
11
graphql-compose-relay
22
======================
3-
This is a plugin for `graphql-compose`, which wraps graphql types and resolvers with Relay specific things, like `Node` type and interface, `globalId`, `clientMutationId`.
3+
This is a plugin for `graphql-compose`, which wraps GraphQL types with Relay specific things, like `Node` type and interface, `globalId`, `clientMutationId`.
44

5-
To-Do
6-
=====
7-
- [ ] realize `clientMutationId` for resolvers with `kind = 'mutation'`
8-
- [ ] realize `globalId` wrapper for Id fields
9-
- [ ] create `Node` type, interface and type resolver
5+
6+
Example
7+
=======
8+
```js
9+
import composeWithRelay from 'graphql-compose-relay';
10+
11+
composeWithRelay(rootQueryTypeComposer); // add `node` field to RootQuery
12+
composeWithRelay(userTypeComposer); // wrap Type with middlewares, that add fields and tune resolver.
13+
composeWithRelay(someOtherTypeComposer);
14+
```
15+
That's all!
16+
- No annoying `clientMutationId` manipulations (declaration, passthru, stripping from input).
17+
- Add `id` field to type (or wrap it). This field returns globally unique ID among all types in format `base64(TypeName + ':' + recordId)`
18+
All done internally by middleware for you.
19+
20+
Requirements
21+
============
22+
TypeComposer should follow following requirements:
23+
- has defined `recordIdFn` (function that from object gives you id)
24+
- should have `findById` resolver
25+
26+
About `TypeComposer` you may read here [graphql-compose](https://github.com/nodkz/graphql-compose)
27+
28+
Compatible plugins
29+
==================
30+
- [graphql-compose-mongoose](https://github.com/nodkz/graphql-compose-mongoose)
1031

1132

1233
[CHANGELOG](https://github.com/nodkz/graphql-compose-relay/blob/master/CHANGELOG.md)

0 commit comments

Comments
 (0)