0.4.0 • Published 1 year ago

graphql-continuations v0.4.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

GraphQL Continuations

A WIP idea around a simpler approach to the problem solved by @defer. Adds a continuation field to the Query and any types implementing the Relay Node interface. Resolves the selection set underneath the query and executes.

npm i graphql-continuations

Try it out:

import { addContinuationsToSchema, memoryAdapter } from "graphql-continuations";

const schema = addContinuationsToSchema(myExistingSchema, {
  adapter: memoryAdapter(), // redisAdapter() or custom adapter intended for production usage
});

Overview / Summary:

https://htmlpreview.github.io/?https://github.com/tgriesser/graphql-continuations/blob/main/docs/index.html

fragment ExpensiveUserData on User {
  id
  remoteProfile {
    data
  }
}

query QueryWithNestedData {
  viewer {
    id
    name
    continuation(waitMs: 100) {
      __typename
      ... on Continuation {
        continuationId
      }
      ...ExpensiveUserData
    }
  }
}

query ResolveUserData($cid: String!) {
  resolveContinuation(continuationId: $cid) {
    ...ExpensiveUserData
  }
}

TODO:

Proper field level configuration

Feedback welcome!

License

MIT

0.3.0

1 year ago

0.4.0

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago