Open ThisIsMissEm opened 6 years ago
@ThisIsMissEm - Hey! Thank you for this, I apologize for the delay. I will review your proposed changes this week, at first glance I'm super stoked to see what you have done!
@ThisIsMissEm @kmills006 can we make this happen? This is the first/only graphql datasource for ApolloServer - would love to contribute to this instead of rolling my own DataSource.
I think the proposed changes are great and would love to see them merged. Then add resolveURL() and some tests. It all depends on if this PR get's merged.
Hi! I'm no longer using this in a work context, so I'm not sure when I'll get time to loopback around and update it. Feel free to make changes.
Emelia
On 21. Dec 2018, at 15:15, Henrik Kok Jørgensen notifications@github.com wrote:
@hkjorgensen commented on this pull request.
In src/GraphQLDataSource.ts:
}
- private async executeSingleOperation(operation: GraphQLRequest) {
- const link = this.composeLinks();
- const [error, response] = await to(makePromise(execute(link, operation)));
- if (error) {
- this.didEncounterError(error);
- }
- return response;
- }
- private resolveUri(): string { please don't remove this per https://www.apollographql.com/docs/apollo-server/v2/features/data-sources.html#Resolving-URLs-dynamically.
Should be renamed to resolveURL
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Novice programmer here, made a package to use datasource pattern for graphql endpoints with Apollo Client cache for stitching, would love comments/suggestions on the approach, the code, whatever, etc, etc.
Documentation: https://yaacovcr.github.io/apollo-stitcher Working example: https://github.com/yaacovCR/nextjs-graphql-starter
I am not too familiar with TypeScript, much of this could probably be reoriented by those more in the know as pull requests to graphql-tools and/or this package.
@kmills006 These changes seem like they would really benefit the community and set the stage for more people to be able to contribute in the right direction. Given that the author isn't in a position to merge, could you finish the effort?
Currently the GraphQLDataSource package kind of follows RESTDataSource, but also uses ApolloLink infrastructure. It'd be great to have this basically like using ApolloClient, e.g.
This would allow custom error handling, usage of batching, retries, etc.
This commit also adds some missing types and raises several questions.