prisma-archive / graphcool-lib

A convenient tool to use in Graphcool functions to make requests against your Graphcool API
33 stars 6 forks source link

New terminology #9

Closed schickling closed 7 years ago

schickling commented 7 years ago

With many terminology changes being introduced in https://github.com/graphcool/graphcool, graphcool-lib also needs to be updated.

The following library changes have been introduced:

Changes required from the backend

      mutation {
        generateNodeToken(input: {
          rootToken: "${this.rootToken}"
          serviceId: "${this.serviceId}"
          nodeId: "${nodeId}", 
          modelName: "${typeName}",
          expirationInSeconds: Int
          clientMutationId: "static"
        }) {
          token
        }
      }

Notes

kbrandwijk commented 7 years ago

You have kept the tokenOrRootToken method, but at the same time, the rename caused the behavior to change, and a single token to be used.

fromEvent used to set the pat (now rootToken), api() used to set to token when specified in the options. However, there is no rootToken anywhere. I proposed going forward with one token, but then the tokenOrRootToken method is no longer needed.

kbrandwijk commented 7 years ago

Another question: can you restructure the code so the new createSchema method goes into a different class? Because now whenever you require graphcool-lib, you're also pulling all these extra dependencies in (apollo-link-http, graphql, graphql-tools), making this lightweight module a lot heavier then it needs to be, because the createSchema functionality is very specific, and will never be used in functions.

kbrandwijk commented 7 years ago

I like the fact that parameter naming is consistent now. Just token. However, as generateNodeToken specifically requires a rootToken, there should be an additional check to see if the provided token is a rootToken or not.

kbrandwijk commented 7 years ago

@timsuchanek The release notes don't mention the biggest breaking change: having to specify endpoints manually outside resolver functions!

mwickett commented 7 years ago

@kbrandwijk Can you elaborate on that change?

kbrandwijk commented 7 years ago

@mwickett Yes, I created https://github.com/graphcool/graphcool-lib/issues/14 for it, but it is already fixed by @timsuchanek.