Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@keystonejs/app-graphql

keystonejs1.6kMIT6.3.3TypeScript support: definitely-typed

KeystoneJS GraphQL App.

readme

GraphQL app

This is the last active development release of this package as Keystone 5 is now in a 6 to 12 month active maintenance phase. For more information please read our Keystone 5 and beyond post.

View changelog

A KeystoneJS app that creates a GraphQL API and GraphiQL playground.

Note: The GraphiQL playground is disabled in production mode.

For information about writing queries and mutations for KeystoneJS see the Introduction to KeystoneJS' GraphQL API.

Usage

const { Keystone } = require('@keystonejs/keystone');
const { GraphQLApp } = require('@keystonejs/app-graphql');
const { AdminUIApp } = require('@keystonejs/app-admin-ui');

module.exports = {
  keystone: new Keystone(),
  apps: [
    new GraphQLApp({
      // All config keys are optional. Default values are shown here for completeness.
      apiPath: '/admin/api',
      graphiqlPath: '/admin/graphiql',
      schemaName: 'admin',
      apollo: {},
    }),
    new AdminUIApp(),
  ],
};

Config

Option Type Default Description
apiPath String /admin/api Change the API path
graphiqlPath String /admin/graphiql Change the GraphiQL playground path
schemaName String admin Change the graphQL schema name (not recommended)
apollo Object {} Options passed directly to Apollo Server

Setting a custom schemaName

To use a custom schemaName, please ensure it is also passed in to the keystone constructor at initialization.

changelog

@keystonejs/app-graphql

6.3.3

Patch Changes

6.3.2

Patch Changes

6.3.1

Patch Changes

6.3.0

Minor Changes

Patch Changes

6.2.2

Patch Changes

6.2.1

Patch Changes

6.2.0

Minor Changes

  • 1200c3562 #4588 Thanks @timleslie! - Updated graphql server to use the graphql-upload package directly to support uploads, rather than the built-in support provided by Apollo Server.

6.1.3

Patch Changes

6.1.2

Patch Changes

6.1.1

Patch Changes

6.1.0

Minor Changes

  • 5a3849806 #3262 Thanks @MadeByMike! - Added a new private internal schema that will allow a better method of bypassing access control on the executeGraphQL function.

    The schema name internal is now a reserved name and if you have a schema with this name you will need to change it with this update.

    Note: You cannot change access control on the internal schema.

6.0.0

Major Changes

  • 3ce644d5f #3174 Thanks @timleslie! - Replaced keystone.getGraphQlContext() with keystone.createHTTPContext(), to be used primarily by the Apollo server. If you need to create a context for executing server-side GraphQL operations please use keystone.createContext(). See the docs for more details on how to use keystone.createContext().

Patch Changes

5.1.9

Patch Changes

5.1.8

Patch Changes

5.1.7

Patch Changes

5.1.6

Patch Changes

5.1.5

Patch Changes

5.1.4

Patch Changes

5.1.3

Patch Changes

5.1.2

Patch Changes

5.1.1

Patch Changes

5.1.0

Minor Changes

Patch Changes

5.0.4

Patch Changes

  • b8631cf7 #2320 Thanks @Vultraz! - Updated graphql dependency from 14.4.2 to 14.6.0 and graphql-type-json depedency from 0.2.1 to 0.3.1.

  • 36a3e6a0 #2323 Thanks @Vultraz! - Updated Apollo-related dependencies:

    apollo-boost: 0.4.4 -> 0.4.7 apollo-cache-inmemory: 1.5.1 -> 1.6.5 apollo-client: 2.6.4 -> 2.6.8 apollo-server-express: 2.9.1 -> 2.9.16 apollo-upload-client: 10.0.0 -> 12.1.0 apollo-utilities: 1.3.2 -> 1.3.3

  • Updated dependencies [59fd3689]:

5.0.3

Patch Changes

  • ec81468c #2308 - Fixed bug preventing configuration of apollo graph engine from GraphQLApp().

5.0.2

Patch Changes

5.0.1

Patch Changes

5.0.0

Major Changes

  • 7b4ed362 #1821 Thanks @jesstelford! - Release @keystonejs/* packages (つ^ ◡ ^)つ

    • This is the first release of @keystonejs/* packages (previously @keystone-alpha/*).
    • All packages in the @keystone-alpha namespace are now available in the @keystonejs namespace, starting at version 5.0.0.
    • To upgrade your project you must update any @keystone-alpha/* dependencies in package.json to point to "@keystonejs/*": "^5.0.0" and update any require/import statements in your code.

Patch Changes

@keystone-alpha/app-graphql

8.2.1

Patch Changes

8.2.0

Minor Changes

  • 588c50cd: Support protection against Billion Laughs DoS attacks

8.1.1

Patch Changes

  • 9b532072: Rename Keystone to KeystoneJS in docs where possible in docs

8.1.0

Minor Changes

  • b9e2c45b: Add support for query validation

8.0.0

Major Changes

  • f8ad0975: The cors and pinoOptions parameters now live on keystone.prepare() rather than new GraphQLApp()

Patch Changes

  • c99c7cd2: First iteration of the GraphQLPlaygroundApp.
  • a8e9378d: Keystone, List and Field constructors now take schemaNames as config options. A number of methods also now take schemaName parameters.
    • keystone.getTypeDefs() -> keystone.getTypeDefs({ schemaName })
    • keystone.getAdminSchema() -> keystone.getAdminSchema({ schemaName })
    • keystone.dumpSchema(file) -> keystone.dumpSchema(file, schemaName)
    • keystone.getAdminMeta() -> keystone.getAdminMeta({ schemaName })
    • list.getAdminMeta() -> list.getAdminMeta({ schemaName })
    • field.getAdminMeta() -> field.getAdminMeta({ schemaName })

7.0.0

Major Changes

  • 8d0d98c7: cookieSecret and sessionStore config options are now passed to the Keystone constructor instead of the individual auth or graphql packages.

Patch Changes

  • b27f6eed: Upgrade apollo-server to 2.9.1

6.3.1

Patch Changes

6.3.0

Minor Changes

  • 04371d0d:

    Prepare middlewares for auth strategies immediately after setting up session middleware.

6.2.0

Minor Changes

  • 91fffa1e:

    Expose the incoming Request object as context.req enabling things like logging IPs in custom hooks, etc.

6.1.0

Minor Changes

  • 1b4cf4e0:

    • GraphQL Playground now correctly sends auth cookies by default.
    • The GraphQL context object now has startAuthedSession and endAuthedSession methods bound to the current request (from @keystone-alpha/session)

Patch Changes

6.0.0

Major Changes

  • This packages has been renamed from server.

  • dfcabe6a:

    Specify custom servers from within the index.js file

    • Major Changes:
      • The index.js export for admin must now be exported in the servers array:
         module.exports = {
           keystone,
        -  admin,
        +  apps: [admin],
         }
      • The keystone.prepare() method (often used within a Custom Server server.js) no longer returns a server, it now returns a middlewares array:
        +const express = require('express');
         const port = 3000;
         keystone.prepare({ port })
        -  .then(async ({ server, keystone: keystoneApp }) => {
        +  .then(async ({ middlewares, keystone: keystoneApp }) => {
             await keystoneApp.connect();
        -    await server.start();
        +    const app = express();
        +    app.use(middlewares);
        +    app.listen(port)
           });
  • b2651279:

    Remove usage of port arg from prepareMiddleware() and stop doing inline console.logs

@keystonejs/server

@keystone-alpha/server

5.0.0

Major Changes

  • b7a2ea9c:

    • Remove .config property from WebServer. No longer allow admin ui or cookie secret as config fields. User must use adminUI and cookieSecret respectively.

Minor Changes

  • 6f598e83:

    • Add Admin UI static building

Patch Changes

4.0.1

  • [patch]ec76b500:

    • Don't create graphiql shortlinks for multipart forms

4.0.0

  • [patch]b69fb9b7:

    • Update dev devependencies
  • [patch]baff3c89:

    • Use the updated logger API
  • [patch]78266983:

    • Restructure internal code
  • [major]656e90c2:

    • WebServer.start() no longer takes any arguments. Developer must now explicitly call keystone.connect() before calling WebServer.start().
  • [minor]21be780b:

    • Expose createApolloServer in the public API
  • Updated dependencies baff3c89:

3.0.0

  • [patch]022724ab:

    • Factor out a createApolloServer function.
  • [patch]289123a6:

    • Decouple creation of ApolloServer from setting up of middleware
  • [patch]52f1c47b:

    • Use the new Keystone.registerSchema interface.
  • [major]5ebf4c3a:

    • Remove the .sessionManager property from the Keystone class
  • [patch]5ebf4c3a:

    • Use the new @keystone-alpha/session package
  • Updated dependencies d718c016:

  • Updated dependencies 5ebf4c3a:

2.0.2

2.0.1

  • [patch]0c754410:

    • Fix the graphql dev query links

2.0.0

  • [patch]1f2ebc81:

    • Internal refactoring
  • [major]de616f7e:

    • Update authStrategy APIs
      • Removes authStrategy from the config API of Webserver.
      • Removes authStrategy from the serverConfig of the core keystone system builder.
      • Removes the setAuthStrategy method from AdminUI.
      • Adds authStrategy to the config API of AdminUI.
      • Webserver checks keystone.auth to determine whether to set up auth session middlewares.

1.2.0

  • [minor]74e0363:

    • Reinstate ability to pass args to keystone.connect
  • [patch]7417ea3a:

    • Update patch-level dependencies

1.1.0

  • [minor]91557b24:

    • Make links in terminal clicky where possible
  • [patch]1f0bc236:

    • Update the package.json author field to "The Keystone Development Team"
  • [patch]9534f98f:

    • Add README.md to package

1.0.0

  • [major] 8b6734ae:

    • This is the first release of keystone-alpha (previously voussoir). All packages in the @voussoir namespace are now available in the @keystone-alpha namespace, starting at version 1.0.0. To upgrade your project you must update any @voussoir/<foo> dependencies in package.json to point to @keystone-alpha/<foo>: "^1.0.0" and update any require/import statements in your code.

@voussoir/server

1.1.0

  • [minor] 6fedba68:

    • DX: Show incoming queries in console and GraphiQL
  • [patch] 113e16d4:

    • Remove unused dependencies
  • [patch] d0fbd66f:

    • Update apollo dependencies on both client and server

1.0.0

  • [major] 723371a0:

    • Correctly surface nested errors from GraphQL
  • [minor] ced0edb3:

    • Allow passing of Apollo Server config via webserver
  • Updated dependencies [aca26f71]:

  • Updated dependencies [a3d5454d]:

0.5.1

  • [patch] 4d198f04:

    • Update dependencies: apollo-server-express -> 2.3.1
  • [patch] 8d8666ad:

    • Dependency upgrade: graphql -> 14.0.3, graphql-tools -> 4.0.3

0.5.0

  • [minor] c83c9ed5:

    • Add Keystone.getAccessContext and remove List.getAccessControl, List.getFieldAccessControl, and Field.validateAccessControl.
  • [patch] d22820b1:

    • Rename keystone.session to keystone.sessionManager
      • Rename keystone.session.validate to keystone.sessionManager.populateAuthedItemMiddleware
      • Rename keystone.session.create to keystone.sessionManager.startAuthedSession
      • Rename keystone.session.destroy to keystone.sessionManager.endAuthedSession
  • [patch] fc1a9055:

    • Update dependencies to latest patch versions

0.4.0

  • [minor] ae3b8fda:

    • Makes CORS user configurable

0.3.0

  • [minor] 47c7dcf6" :

    • Bump all packages with a minor version to set a new baseline

0.2.1

0.2.0

  • [minor] Add missing dependencies for which the mono-repo was hiding that they were missing fed0cdc

0.1.2

  • [patch] Rename readme files a8b995e

0.1.1

  • [patch] Remove tests and markdown from npm dc3ee7d