Giter VIP home page Giter VIP logo

gramps-express's People

Contributors

corycook avatar greenkeeper[bot] avatar jlengstorf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gramps-express's Issues

Fix CLI wording and help links

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.

Update data source tutorial to use more dependable API example

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:

  • No API key required — we want people to immediately start coding, not have to sign up for API keys
  • Reliable — should be up more often than not
  • Relatively simple — if we can find a small API with one method, that would actually be the best option. A complete example that doesn’t involve a ton of copy-pasting would make the tutorial much more approachable than having to click through to GitHub for the rest of the code and/or copying hundreds of lines of code to get a proof-of-concept running

I'm currently leaning toward the xkcd API, which is small, reliable, and familiar to many developers.

Add tests for the CLI

The CLI currently doesn't have any tests written. We'll probably need a light refactor to make it easier to test.

Make docs site responsive

The site is showing its enterprise roots and only works on desktops.

shame

The left nav should probably collapse to a dropdown or hamburger or something.

[Discussion] Shape of data-source

@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.

Existing

  1. context: String (used to set property name on each queries context)
  2. model: Model (added to each queries context)
  3. schema: String (text of the Schema)
  4. resolvers 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.

Proposed

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).

  1. typeDefs: String (text of the Schema)
  2. resolvers: Object (the exact object that would be passed to makeExecutableSchema in a standard apollo-server, including Query, Mutation, and Subscription)
  3. mocks: Object (the exact object that would be passed to addMockFunctionsToSchema)
  4. context: Function (same as function passed directly into graphqlExpress

I 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!)

Specifics (implementation details)

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();
  };

Add `all-contributors`

Add all-contributors and run it in the Travis process so we're giving contributors proper credit.

Can we drop this repo in favor of `@gramps/gramps`?

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.

An in-range update of prettier is breaking the build 🚨

The devDependency prettier was updated from 1.14.2 to 1.14.3.

🚨 View failing branch.

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.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for 1.14.3

🔗 Changelog

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .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.

More information on this issue

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 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Write developer quickstart

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.

An in-range update of nodemon is breaking the build 🚨

The devDependency nodemon was updated from 1.18.5 to 1.18.6.

🚨 View failing branch.

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.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v1.18.6

1.18.6 (2018-11-05)

Bug Fixes

Commits

The new version differs by 1 commits.

  • 521eb1e fix: restart on change for non-default signals (#1409) (#1430)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of eslint-plugin-import is breaking the build 🚨

The devDependency eslint-plugin-import was updated from 2.18.2 to 2.19.0.

🚨 View failing branch.

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.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

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

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Add support for GraphQL subscriptions

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.

Dataloader question

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.

Write API docs

Every method exposed by GrAMPS needs to be documented.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.