Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Road towards relay compatibility #22

Closed
hardchor opened this issue Aug 23, 2015 · 13 comments
Closed

Road towards relay compatibility #22

hardchor opened this issue Aug 23, 2015 · 13 comments

Comments

@hardchor
Copy link
Contributor

N.B.: Moved this from RisingStack/graffiti#7

Just putting some thoughts down of currently missing features:

Unique Object IDs

Relay wants to be able to (re-)fetch any object in the graph by a unique ID via a root query named node:

node (id: "user123") {
  id
  name
}

Relay methods: fromGlobalId/toGlobalId
See: https://github.com/relayjs/relay-starter-kit/blob/master/data/schema.js#L115

Pagination

On the query side, relay requires first and after arguments (as well as last and before for backwards pagination):

users (first: 10, after: "user123") {
  edges {
    cursor
    node {
      id
      name
    }
  }
  pageInfo {
    hasNextPage
  }
}

Also see: https://facebook.github.io/relay/graphql/connections.htm

Mutation

TBC

Fragment support

Connections

I expect graphql-relay-js to help us out with the more intricate details

I hope we can work towards relay compatibility. Please let me know if this is more appropriate for an adapter, e.g. graffiti-mongoose

@hardchor
Copy link
Contributor Author

@hekike @gergelyke Are you guys still developing this? Feels like the project is already dead before it even got off the ground...

@gergelyke
Copy link
Contributor

hi @hardchor,

thanks for raising them! in the past weeks sadly we did not have the time that this project would deserve - could you help us out and send a PR with these?

@hardchor
Copy link
Contributor Author

I'm still at the crossroads which route to take:

  • mongo - mongoose - graffiti or
  • SQL - bookshelf - graphql-bookshelf

Before I invest any significant amount of time, how likely are you to continue this project, i.e. are you going to be using it in production apps or is it all still a bit in the air?

Also, mutation is a biggie - whilst not being a completely blocker for this ticket, not having mutations would certainly leave a big gap in any Relay integration. https://github.com/RisingStack/graffiti-mongoose/milestones/support%20mutation%20queries

@gergelyke
Copy link
Contributor

We definitely want to use it in production applications - with that said, I would go for finishing up one graffiti adapter implementation first, this one, so we will have a reference when working with others, like bookshelf.

What do you think?

@hardchor
Copy link
Contributor Author

Totally agreed. Could have a bit of a catch up on Skype if you fancy.

@gergelyke
Copy link
Contributor

in which timezone are you in? let's find a time which can work.

cc-ing in @hekike

@hardchor
Copy link
Contributor Author

GMT. Added you both to https://gitter.im/hardchor/graffiti

@ghost ghost mentioned this issue Sep 28, 2015
6 tasks
@parkan
Copy link

parkan commented Sep 29, 2015

Given that the cursors are specified as opaque, I don't see why cursors and globally unique IDs need be the same. The global id could take the format of $collection:$_id and cursors could be $_id if indexing into a collection (data structured with parent references) or maybe even numerical offsets if indexing into a subelement of child references.

EDIT: globalIdField used here works nicely, wrapping the same information https://github.com/RisingStack/graffiti-mongoose/pull/27/files#diff-55c36325e001f1671db3cf8a5b686a2aR59

@ghost
Copy link

ghost commented Oct 2, 2015

@parkan They are opaque, but as you already noted, encoded as a globally unique ID (just a simple base64 encoding)

@tothandras
Copy link
Contributor

We have added the node(ID!) endpoint and pagination support and we are currently working on the mutation support. The new version is published on npm (^3.0.0). Your feedback is welcome!

@gergelyke
Copy link
Contributor

I guess we can close this, right?

@hardchor
Copy link
Contributor Author

I think we're still some way off full relay compatibility:

  • viewer endpoint
  • mutations

@tothandras
Copy link
Contributor

The viewer endpoint and mutations have already been added. Check out the latest version!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants