gramps-graphql / gramps-express Goto Github PK
View Code? Open in Web Editor NEWNOTE: The GrAMPS core has moved to https://github.com/gramps-graphql/gramps
License: MIT License
NOTE: The GrAMPS core has moved to https://github.com/gramps-graphql/gramps
License: MIT License
Running yarn live-data
still shows mock data. Rendering needs to respect both NODE_ENV === 'production'
and GRAMPS_MODE === 'live'
.
Add API docs and an intro tutorial for the CLI.
Right now the CLI still calls local data sources "external" data sources, which is weird and confusing.
Also, it links to internal IBM docs, which is probably not all that helpful to most people. So maybe fix that. We'll also need to move the CLI docs into the public docs for that to be possible, so #35 is a blocker for this.
Missing file extension for "express"
It turns out the IMDB API is pretty unreliable, which is a bummer. This makes it a bad choice for an example data source.
We should revamp the tutorial to use a more reliable API. Requirements are:
I'm currently leaning toward the xkcd API, which is small, reliable, and familiar to many developers.
This should point to the GrAMPS docs or be removed altogether since there aren't specific docs available for this error right now.
The CLI currently doesn't have any tests written. We'll probably need a light refactor to make it easier to test.
@jlengstorf I really enjoyed your talk today at GraphQL Summit and having the opportunity to speak with you afterwards. Thank you!
(sorry, this ended up being longer than I expected)
I've taken some time to grok the gist of how data-sources are created and how gramps-express consumes them. As I understand it a data source provides four values.
String
(used to set property name on each queries context
)Model
(added to each queries context
)String
(text of the Schema)Object
(object with queryResolvers
, mutationResolvers
, dataResolvers
, mockResolvers
, and someday subscriptionResolvers
)This took some time to wrap my mind around. I think this is because these values are different than what makeExecutableSchema
and addMockFunctionsToSchema
expect.
I believe that the essence of a data source is more clearly captured with the following four values (which can be passed almost directly into makeExecutableSchema
and addMockFunctionsToSchema
(and query context).
String
(text of the Schema)Object
(the exact object that would be passed to makeExecutableSchema
in a standard apollo-server, including Query
, Mutation
, and Subscription
)Object
(the exact object that would be passed to addMockFunctionsToSchema
)Function
(same as function passed directly into graphqlExpressI believe the Model
+ Connector
pattern you've created is one way to wire up the context
and resolvers
. Every graphql developer should be familiar with creating typeDefs
, resolvers
, and mocks
(they do it every day!)
A new combineResolvers would look something like this:
import merge from 'lodash.merge';
// simply deep merge the objects
export const combineResolvers = (sources, initial = {}) => sources.reduce(merge, initial)
a new getSchema would look like this:
export const getSchema = ({ sources, logger, options }) =>
makeExecutableSchema({
// Combine all the schema definitions into an array.
typeDefs: [rootSchema, ...sources.map(source => source.typeDefs)],
resolvers: combineResolvers(sources.map(source => source.resolvers), {
Query: {grampsVersion: () => pkg.version},
Mutation: {grampsPing: () => 'GET OFF MY LAWN'}
}
},
logger,
...options,
});
export const addMockFunctions = ({ sources, schema, options }) => {
addMockFunctionsToSchema({
mocks: combineResolvers(sources.map(source => source.mocks)),
schema,
...options,
});
Finally, context
is added like so: here
return (req, res, next) => {
const context = sources
.map(source => source.context)
.reduce((combined, fn) => merge(combined, fn ? fn(req) : {}), {});
req.gramps = {
schema,
context,
formatError: formatError(logger),
...apolloOptions.graphqlExpress,
};
next();
};
Missing file extension for "express"
Write up a step-by-step tutorial for creating a GrAMPS data source.
Add all-contributors
and run it in the Travis process so we're giving contributors proper credit.
In looking at the various Apollo server implementations, the config object (GraphQLOptions
) appears to be the same in all situations.
We need to test that, but if that's true, there's really no need to use this middleware. Instead, the API can be simplified in a universally applicable way to:
import gramps from '@gramps/gramps';
const getGraphQLOptions = gramps({ dataSources: [] });
In Express/Connect, we would use:
app.use('/graphql', bodyParser.json());
app.use('/graphql', graphqlConnect(getGraphQLOptions));
In Hapi:
server.register({
register: graphqlHapi,
options: {
path: '/graphql',
graphqlOptions: getGraphQLOptions,
},
});
Koa:
app.use(koaBody());
router.post('/graphql', graphqlKoa(getGraphQLOptions));
app.use(router.routes());
Once @gramps/gramps
hits a stable release, let's look at deprecating this repo altogether.
1.14.2
to 1.14.3
.This version is covered by your current version range and after updating it in your project the build failed.
prettier is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didn’t already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Whenever an error happens in a query, the log is correct on the server, but shows up null
on the client side.
Docs for getting a GrAMPS-powered GraphQL server up and running in ~5 minutes. Should start with installing packages and end with a successful query in GraphiQL.
1.18.5
to 1.18.6
.This version is covered by your current version range and after updating it in your project the build failed.
nodemon is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 1 commits.
521eb1e
fix: restart on change for non-default signals (#1409) (#1430)
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Right now the caching scheme is hard-coded — let's make it easy for a connector to override a method and define their own cache key generation function.
Add middleware to attach a Redis instance to GrAMPS for caching. This will be a new package.
We should have these in place and make it easy to extend them.
What needs to change in a data source if data is coming from a database instead of a REST API? Let's figure it out, build a test case, and document it.
2.18.2
to 2.19.0
.This version is covered by your current version range and after updating it in your project the build failed.
eslint-plugin-import is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 46 commits.
9b76635
Bump to v2.19.0
47a232e
[resolvers/webpack] v0.12.0
26ad476
[resolvers/webpack] [deps] update debug
, enhanced-resolve
, has
, interpret
, lodash
, resolve
, semver
3f0e8f3
[resolvers/node] [Deps] update resolve
7190c3e
bump utils to v2.5.0
a60e5c6
[New] no-commonjs
: add allowConditionalRequire
option
414c923
[New] enable passing cwd as an option to eslint-import-resolver-webpack
8224e51
[New] order
/no-extraneous-dependencies
: Alphabetize imports within groups
f12ae59
[New] no-duplicates
: add a considerQueryString option to handle false positives when using some webpack loaders.
2d3d045
[fix] importType
: Accept '@example' as internal
0426f16
[New] order
: add pathGroups option to add support to order by paths
99b3fbf
[Fix] no-extraneous-dependencies
: Add support for export from
21bf8c6
[Fix] no-cycle
: should not warn for Flow imports
0cd5e43
[Fix] no-unused-modules
: fix crash due to export *
05085bb
[flow] no-unused-modules
: add flow type support
There are 46 commits in total.
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
My team would love to use the GrAMPS architecture, but we're blocked by not having subscription support. It would be great if we could have a basic subscription implementation so data sources can add their own subscriptions.
The error handling process is a little magical/black-boxy — fix that.
Follow prettier
formatting (expected '.' but found '\n').
Looking at the GraphQLConnector, the dataloader is constructed every time get()
is called. This means every HTTP call creates a new dataloader, rather than getting a new dataloader for every graphql request.
It looks like the models and connectors are singletons constructed once, and not for every request. Looking at the GitHunt api, a new model and connector are created for every single request. I'm thinking gramps' behavior should change to match the GitHunt API to enable using dataloaders correctly.
Should the behavior be changed to construct the datasources for each request, rather than treating them as singletons? Otherwise I'm uncertain how per-request caching can occur using dataloaders.
Every method exposed by GrAMPS needs to be documented.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.