File tree Expand file tree Collapse file tree 5 files changed +14
-7
lines changed Expand file tree Collapse file tree 5 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -13,4 +13,4 @@ esproposal.class_instance_fields=enable
1313suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
1414
1515[version]
16- 0.28 .0
16+ 0.29 .0
Original file line number Diff line number Diff line change @@ -4,6 +4,13 @@ This is a plugin for [graphql-compose](https://github.com/nodkz/graphql-compose)
44
55[ CHANGELOG] ( https://github.com/nodkz/graphql-compose-relay/blob/master/CHANGELOG.md )
66
7+ Installation
8+ ============
9+ ```
10+ npm install graphql graphql-compose graphql-compose-relay --save
11+ ```
12+ Modules ` graphql ` and ` graphql-compose ` are in ` peerDependencies ` , so should be installed explicitly in your app. They have global objects and should not have ability to be installed as submodule.
13+
714Example
815=======
916` TypeComposer ` is a [ graphql-compose] ( https://github.com/nodkz/graphql-compose ) utility, that wraps GraphQL types and provide bunch of useful methods for type manipulation.
Original file line number Diff line number Diff line change 2222 "url" : " https://github.com/nodkz/graphql-compose-relay/issues"
2323 },
2424 "homepage" : " https://github.com/nodkz/graphql-compose-relay" ,
25- "dependencies" : {
26- "graphql-compose" : " >=0.0.6"
27- },
2825 "peerDependencies" : {
29- "graphql" : " ^0.5.0"
26+ "graphql" : " >=0.5.0 || >=0.6.0" ,
27+ "graphql-compose" : " >=0.0.7 || >=1.0.0"
3028 },
3129 "devDependencies" : {
3230 "babel-cli" : " 6.10.1" ,
4745 "eslint-plugin-import" : " 1.10.2" ,
4846 "eslint-plugin-jsx-a11y" : " 1.5.5" ,
4947 "eslint-plugin-react" : " 5.2.2" ,
50- "flow-bin" : " 0.28 .0" ,
48+ "flow-bin" : " 0.29 .0" ,
5149 "mocha" : " 2.5.3" ,
5250 "rimraf" : " 2.5.2" ,
5351 "sane" : " 1.3.4"
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export function unbase64(i: Base64String): string {
1717 * Takes a type name and an ID specific to that type name, and returns a
1818 * "global ID" that is unique among all types.
1919 */
20- export function toGlobalId ( type : string , id : string ) : string {
20+ export function toGlobalId ( type : string , id : string | number ) : string {
2121 return base64 ( [ type , id ] . join ( ':' ) ) ;
2222}
2323
Original file line number Diff line number Diff line change 88import { fromGlobalId } from './globalId' ;
99import NodeInterface from './nodeInterface' ;
1010import type { TypeFindByIdMap } from './definition.js' ;
11+ import { getProjectionFromAST } from 'graphql-compose' ;
1112
1213// this fieldConfig must be set to RootQuery.node field
1314export function getNodeFieldConfig ( typeToFindByIdMap : TypeFindByIdMap ) {
@@ -35,6 +36,7 @@ export function getNodeFieldConfig(typeToFindByIdMap: TypeFindByIdMap) {
3536 args : { [ idArgName ] : id } , // eg. mongoose has _id fieldname, so should map
3637 context,
3738 info,
39+ projection : getProjectionFromAST ( info ) ,
3840 } ) . then ( res => {
3941 if ( res ) {
4042 res . __nodeType = findById . getTypeComposer ( ) . getType ( ) ;
You can’t perform that action at this time.
0 commit comments