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

Package detail

@keystone-6/core

keystonejs25.3kMIT6.5.1TypeScript support: included

Keystone-6 is the latest version of Keystone. To get help with this package join the conversation in Slack, or Github.

readme

Keystone: The superpowered CMS for developers



Keystone helps you build faster and scale further than any other CMS or App Framework. Describe your schema, and get a powerful GraphQL API & beautiful Management UI for your content and data.

No boilerplate or bootstrapping – just elegant APIs to help you ship the code that matters without sacrificing the flexibility or power of a bespoke back-end.

Contents

Usage & Documentation

Keystone 6 is published to npm under the @keystone-6/* namespace.

You can find our extended documentation on our website, but some quick links that might be helpful:

  • Read Why Keystone to learn about our vision and what's in the box.
  • Getting Started walks you through first steps with the create-keystone-app CLI.
  • Our Examples contain a growing collection of projects you can run locally to learn more about a Keystone feature.
  • An API Reference contains the details on Keystone's foundational building blocks.
  • Some Guides offer practical walkthroughs on how to build with those blocks.

💡 While our API Reference is generally complete, we are are still working hard on increasing the fidelity of our guides and examples. If you have an example you'd like see, please open a GitHub discussion!

Our @keystone-6/* packages are written for the Node Maintenance and Active LTS versions of Node; and our continuous integration seamlessly tracks that. You may have success with Node versions that are Pending or End-of-Life, but you may have problems too.

Looking for Keystone 5?

The Keystone 5 codebase is now in maintenance mode and lives at keystonejs/keystone-5. For more information read Keystone 5 and beyond.

Enjoying Keystone?

Interested in what's new?

For a birds-eye view of what the Keystone project is working towards, check out our Roadmap.

Feedback

Share your thoughts and feature requests on Slack (preferred) or Twitter. Bugfixes and issues always welcome.

Versioning

Keystone follows semver.

Code of Conduct

Keystone adheres to the Contributor Covenant Code of Conduct.

Security

For vulnerability reporting, please refer to our security policy.

License

Thinkmill

Copyright (c) 2024 Thinkmill Labs Pty Ltd. Licensed under the MIT License.

changelog

@keystone-6/core

6.5.1

Patch Changes

6.5.0

Minor Changes

  • 0b29faf Thanks @dcousens! - Add support for uniquely filtering items by 1-to-1 relationships

6.4.0

Minor Changes

Patch Changes

  • #9401 48f51be Thanks @dcousens! - Fix list view ignoring .ui.listView.searchFields

  • 424b2a2 Thanks @emmatown! - Fix Admin UI breaking in Safari because of usage of iterator helpers

  • f3cef4c Thanks @mikehazell! - Fixes context.db missing types if they are omitted from GraphQL

6.3.1

Patch Changes

6.3.0

Minor Changes

Patch Changes

6.2.0

Minor Changes

Patch Changes

  • #9166 ad45b05 Thanks @acburdine! - Fix bigInt field type to throw if defaultValue: { kind: 'autoincrement' } and validation.isRequired is set

  • #9217 5ee45ae Thanks @dcousens! - Fix list.ui.hide* defaulting to false when GraphQL is omitted

  • #9164 4262e50 Thanks @renovate! - Fix keystone prisma ... not returning the same error code as the Prisma engine

  • #9155 0aa7317 Thanks @dcousens! - Fix malformed uuid's from breaking relationship filters when using POSTGRESQL

  • #9166 ad45b05 Thanks @acburdine! - Update built-in fields to use newer validate hook syntax

6.1.0

Minor Changes

Patch Changes

  • #9100 3b6ba78 Thanks @dcousens! - Fix config.db.enableLogging types to align with Prisma 5

  • #9099 deecc1b Thanks @dcousens! - Fix keystone command help text to show where --frozen and --no-server are applicable

6.0.0

Major Changes

  • #9083 d609c6b Thanks @dcousens! - Removes unused type parameters from types ListConfig and ListAdminUIConfig

  • #9088 7bbc613 Thanks @dcousens! - Upgrade @prisma/* packages to 5.12.1

  • #8776 e382f9e Thanks @dcousens! - Change keystone prisma behaviour to first require keystone build (or keystone dev)

  • #9083 d609c6b Thanks @dcousens! - Remove the deprecated type parameters from the list and group functions

  • #9085 70ffa67 Thanks @dcousens! - Removes AdminUIConfig, DatabaseConfig, GraphQLConfig and ServerConfig from @keystone-6/core/types, and some unused types - instead use KeystoneConfig['ui'], KeystoneConfig['db'] and so on

  • #9083 d609c6b Thanks @dcousens! - Removes graphqlSchema parameter from extendHttpServer, use context.graphql.schema instead

  • #9083 d609c6b Thanks @dcousens! - Moves config.extendGraphqlSchema to config.graphql.extendGraphqlSchema, similar to db.extendPrismaSchema

  • #9083 d609c6b Thanks @dcousens! - Remove KeystoneConfig parameter from getAdditionalFiles function type

  • #9083 d609c6b Thanks @dcousens! - Remove the deprecated context.exitSudo from KeystoneContext

  • #9083 d609c6b Thanks @dcousens! - Remove context.experimental.initialisedLists, use context.__internal.lists (may break in patch)

  • #9083 d609c6b Thanks @dcousens! - Remove ExtendGraphqlSchema type alias, use (schema: GraphQLSchema) => GraphQLSchema instead (with import type { GraphQLSchema } from 'graphql').

  • #9083 d609c6b Thanks @dcousens! - Remove the deprecated (#8721) config.server.healthCheck, use extendExpressApp instead

  • #9083 d609c6b Thanks @dcousens! - Removes ListSchemaConfig type, use KeystoneConfig['lists'] instead

  • #9083 d609c6b Thanks @dcousens! - Remove db.additionalPrismaDatasourceProperties, use extendPrismaSchema if needed

  • #9083 d609c6b Thanks @dcousens! - Remove db.prismaPreviewFeatures, use extendPrismaSchema if needed

  • #9083 d609c6b Thanks @dcousens! - Remove any type parameter from SessionStore/SessionStoreFunction types

  • #9085 70ffa67 Thanks @dcousens! - Removes @keystone-6/core/system from exports

  • #9090 e21c117 Thanks @dcousens! - Remove deprecated config.db.useMigrations, use --with-migrations process argument or keystone prisma migrate [dev|deploy] instead

  • #9079 2e5b086 Thanks @dcousens! - Changes file and image to use random 128-bit base64url identifiers by default, not uuid

Minor Changes

Patch Changes

5.8.0

Minor Changes

  • #9057 1b55b41 Thanks @dcousens! - Adds {field}.hooks.validate.[create|update|delete] hooks, deprecates validateInput and validateDelete (throws if incompatible)

  • #9056 3d20b94 Thanks @dcousens! - Adds {list}.hooks.validate.[create|update|delete] hooks, deprecates validateInput and validateDelete

  • #9026 8147976 Thanks @dcousens! - Add async to extendHttpServer, to support await on startup

Patch Changes

  • #9027 18eed93 Thanks @dcousens! - Use db.idField of { kind: 'number', kind: 'Int' } internally for singletons

  • #9042 ee1bdac Thanks @dcousens! - Fix static relationship resolution errors to conform to nominal error structure

  • #9026 8147976 Thanks @dcousens! - Fix config.server.cors type preventing value of false

  • #8809 c0dacbf Thanks @dcousens! - Fix defaultIsFilterable and defaultIsOrderable types preventing value of true

  • #9029 f125787 Thanks @dcousens! - Fixes createExpressApp to use context.graphql.schema, not the GraphQLSchema argument

  • #9028 d828013 Thanks @dcousens! - Deprecates extendHttpServer's graphqlSchema argument, use context.graphql.schema instead

  • #9029 f125787 Thanks @dcousens! - Deprecates ExtendGraphQLSchema type, use type (schema: GraphQLSchema) => GraphQLSchema instead

  • #8809 c0dacbf Thanks @dcousens! - Fix global locking by dropping global p-limit on context.query/context.db

  • #9017 3cb0cce Thanks @dcousens! - Fix image field type to use consistent sub-field ordering

  • #9057 1b55b41 Thanks @dcousens! - Fixes the text field type to accept a defaultValue of null

5.7.2

Patch Changes

5.7.1

Patch Changes

  • #8914 25a6586 Thanks @dcousens! - Fix ui.inlineCreate: { ... } for relationships submitting the parent form of nested relationship fields

  • #8909 029b5cf Thanks @dcousens! - Fix ui.listView.initialSort preventing sort by "No field"

  • #8898 871bdcb Thanks @marekryb! - Fix prisma migrate non-interactive environment error

5.7.0

Minor Changes

  • #8837 650fae574 Thanks @dcousens! - Add type FieldHooks to @keystone-6/core/types exports

  • #8826 dc26bdfed Thanks @dcousens! - Add beforeOperation.[create|update|delete] and afterOperation.[create|update|delete] operation routing for list hooks

Patch Changes

5.6.0

Minor Changes

Patch Changes

5.5.1

Patch Changes

  • #8771 650e27e6e Thanks @dcousens! - Fixes ui.isAccessAllowed when undefined, to prevent access to the adminMeta GraphQL query, akin to the behaviour for the default AdminUI pageMiddleware

  • 8c43bd37b Thanks @lahirurane-rau! - Fixes AdminUI overflow bug (#8754) introduced in #8702

5.5.0

Minor Changes

Patch Changes

5.4.0

Minor Changes

  • #8648 d848e7d07 Thanks @dcousens! - Adds arbitrary string identifier support as db: { idField: { kind: 'string' }

  • #8619 6a8f1dd47 Thanks @jim-lake! - Adds itemValue prop for custom field view components to allow value-driven field conditions

  • #8726 404d0d767 Thanks @dcousens! - Adds new random identifier type as db: { idField: { kind: 'random', bytes?: number, encoding?: 'hex' | 'base64url' } }, with a default of 32 bytes, encoded as base64url

  • #8648 d848e7d07 Thanks @dcousens! - Adds new unique filters for querying by more than 1 unique value

  • #8730 4cb05d9a8 Thanks @dcousens! - Changes session secret to a secure random default when not provided

  • #8730 4cb05d9a8 Thanks @dcousens! - Allow falling back to default AWS credential provider

  • #8648 d848e7d07 Thanks @dcousens! - Changes id field behaviours to not reject invalid identifiers when used in GraphQL resolvers, allowing developers to swap idField types without breaking

  • #8648 d848e7d07 Thanks @dcousens! - Adds findOne and findMany support for Singleton lists for identifiers other than the default, not recommended in typical usage

  • #8702 d539d60cf Thanks @lahirurane-rau! - Adds responsive AdminUI menu for smaller device widths

  • #8730 4cb05d9a8 Thanks @dcousens! - Upgrade Prisma version to 4.16.2

Patch Changes

5.3.2

Patch Changes

  • #8641 19bb46034 Thanks @borisno2! - Adds basePath with a default of '/' to pageMiddleware to support redirects when using ui.basePath

5.3.1

Patch Changes

5.3.0

Minor Changes

  • #8545 b8453c63c Thanks @borisno2! - Adds ui.basePath for changing the AdminUI base path, using a dynamic next.config.js

  • #8570 612431b39 Thanks @dcousens! - Adds cookieName as an option for statelessSessions

  • #8545 b8453c63c Thanks @borisno2! - Removes prompt when using CLI --frozen flag and a schema is out of date, CLI now exits

  • #8551 cfd873ef3 Thanks @dcousens! - add resolveInput.{create|update} list hooks as shorthand operation circuitry

  • #8570 612431b39 Thanks @dcousens! - Adds Session type parameter to generated TypeInfo, Lists and Context types, and propagates that type to access control and hooks

  • #8552 ea227f04f Thanks @dcousens! - Adds new unfiltered shorthand function for an empty filter (exported from '@keystone-6/core/access')

Patch Changes

  • #8569 f92aa4010 Thanks @dcousens! - Fix db.enableLogging with an array resulting in keystone dev exiting

  • #8551 cfd873ef3 Thanks @dcousens! - Fixes graphql.isNonNull.create: true TypeScript types to be non-optional

  • #8569 f92aa4010 Thanks @dcousens! - Deprecates @keystone-6/core/system exports (createSystem, createExpressServer, initConfig and createAdminUIMiddleware), will be removed in next breaking change

  • #8552 ea227f04f Thanks @dcousens! - Removes SessionStrategy's type parameter of StartSessionData, removal is non-breaking as the parameter was unusable

  • #8527 1d0e6cdea Thanks @acburdine! - Fixes type generation for lists with omit.query: true

  • #8568 1a997d113 Thanks @MohammadKurjieh! - Change next experimental.appDir: false for now, until resolution found for internal React issues

  • #8551 cfd873ef3 Thanks @dcousens! - fix incompatible field key types when working with resolvedData (#8485)

  • #8562 b8f7cf4b6 Thanks @renovate! - Update @prisma/* to 4.14.0

5.2.0

Minor Changes

  • #8522 23c0e1daf Thanks @dcousens! - Adds support for Prisma Data Proxy client generation, automatically enabled for db.url's with a prisma: prefix

  • #8432 753f479f7 Thanks @renovate! - Updates Prisma version to 4.12.0

  • #8522 23c0e1daf Thanks @dcousens! - Adds a new .types.path configuration option, for specifying where your Keystone types are built

Patch Changes

5.1.0

Minor Changes

Patch Changes

5.0.0

Major Changes

  • #8221 88a7c6986 Thanks @borisno2! - Upgrade Apollo Server to version 4

  • #8307 d33bb4764 Thanks @borisno2! - Removes assumptions about @prisma/client output location, with a new db.prismaClientPath configuration option to set where to import the Prisma client from

  • #8302 254e6d551 Thanks @dcousens! - Removes --reset-db from keystone dev, use keystone prisma db push --force-reset to reset your database

  • #8046 ead1241f4 Thanks @borisno2! - Adds additional flags to the keystone dev, keystone build and keystone start CLI commands

  • #8283 11bb288ff Thanks @dcousens! - Changes graphql.omit type from array to explicit { read: boolean, create: boolean, update: boolean }

  • #8283 11bb288ff Thanks @dcousens! - Changes graphql.*.isNonNull to graphql.isNonNull.*, and adds graphql.isNonNull.update for optimistic locking usecases

  • #8315 907f7b102 Thanks @dcousens! - Removes @keystone-6/core/next from our exports

  • #8280 384748d85 Thanks @dcousens! - Renames isValidSession on pageMiddleware to wasAccessAllowed, which is what it actually is

  • #8221 88a7c6986 Thanks @borisno2! - Remove experimental generateNextGraphqlAPI - use getContext instead

Minor Changes

  • #8321 8e7729880 Thanks @MurzNN! - Extend db.enableLogging to support other Prisma log levels

  • #8264 5a9ca539f Thanks @jhohlfeld! - Add acl option for s3 storage configuration

  • #8241 25a1bf4ed Thanks @borisno2! - Adds an experimental extendPrismaSchema configuration option for lists and fields to mutate the prisma schema

  • #8283 11bb288ff Thanks @dcousens! - Removes keystone build errors for graphql.isNonNull.create and graphql.isNonNull.update when field access control is configured

  • #8298 c14fa5cdd Thanks @dcousens! - Adds a sudo GraphQL extension for the GraphQLSchema passed to extendGraphqlSchema; enabling developers to determine if they are extending the sudo GraphQL schema

  • #8313 75add09c7 Thanks @marekryb! - Add a cursor argument for findMany queries, enabling cursor-based pagination (see Prisma.io documentation for how this works)

Patch Changes

4.0.1

Patch Changes

4.0.0

Major Changes

  • #8073 94e12b408 Thanks @borisno2! - Removes context.startSession and context.endSession - replace with context.sessionStrategy.start and context.sessionStrategy.end as required

  • #8073 94e12b408 Thanks @borisno2! - Removes createContext, createRequestContext - replace any relevant usage with context.sudo(), context.withSession() or context.withRequest()

Minor Changes

Patch Changes

3.1.3

Patch Changes

3.1.2

Patch Changes

3.1.1

Patch Changes

  • 32e200fa7 Thanks @emmatown! - Fixes ui.displayMode in the relationship field incorrectly defaulting to count instead of select

3.1.0

Minor Changes

Patch Changes

3.0.2

Patch Changes

3.0.1

Patch Changes

3.0.0

Major Changes

Minor Changes

  • #7954 c75340fc4 Thanks @dcousens! - Adds new getContext function (from @keystone-6/core/context) for working with a Keystone configuration directly

  • #7841 d7cfada36 Thanks @Noviny! - Adds a search input field to the list view, resulting in a contains query across ui.searchFields joined with the list view filters

  • #7863 524431be6 Thanks @mitchellhamilton! - Adds a new isSingleton property for configuring Singleton lists

  • #7963 25b5bb605 Thanks @dcousens! - Adds [list].graphql.maxTake, a list configuration option to enforce the maximum take value in findMany queries for that list

Patch Changes

2.3.1

Patch Changes

  • 03061416c Thanks @dcousens! - Fixes BigInt values throwing on deserialisation in the item view

  • 65c6ee3de Thanks @marekryb! - Fixes the multiselect field type not using the provided label, access, graphql, isFilterable or isOrderable configuration options

2.3.0

Minor Changes

Patch Changes

2.2.0

Minor Changes

  • #5645 d34a1e0bc Thanks @gautamsi! - Adds cli functions as exports to @keystone-6/core/scripts/cli, assume to be an experimental unstable export and may change in a patch release.

  • #7747 e322ce122 Thanks @willemmulder! - Adds the ability to set additional Prisma datasource fields in the schema.prisma file, for example, referentialIntegrity by adding options to db.additionalPrismaDatasourceProperties

  • #7324 3eaab4919 Thanks @dcousens! - Adds http.Server options as configuration server.options

  • #7683 9d3e40612 Thanks @Achisingh! - Adds a new multiselect field type

  • #7752 0ea56667f Thanks @Achisingh! - Adds ui.displayMode: 'radio' as an option for the select field.

  • #7722 809f707ff Thanks @borisno2! - Adds 'graphql' schema to extendHttpServer.

  • #7658 da0c197c7 Thanks @Achisingh! - Adds calendarDay field to store a date without a time or timezone attached

  • #5175 d2483bb4b Thanks @MurzNN! - Adds a new bigInt field type, an integer of width 8 bytes (64 bits), analogous with Prisma's BigInt.

Patch Changes

2.1.0

Minor Changes

  • #7350 f5fe35573 Thanks @chelkyl! - Adds support for Prisma's shadowDatabaseUrl option with db.shadowDatabaseUrl. Your Prisma schemas will now always include shadowDatabaseUrl = env("SHADOW_DATABASE_URL"), though using db.shadowDatabaseUrl is optional

  • #7188 7f83b438b Thanks @MurzNN! - Adds support for BigInt autoincrement id fields with idField: { kind: 'autoincrement', type: 'BigInt' }

  • #7644 153eb6778 Thanks @borisno2! - Fixes for graphQLSchemaExtension, custom resolvers, if replacing default resolvers, were previously broken

  • #7538 c862e876c Thanks @borisno2! - Adds db.nativeType option to the text field to customise the database type

  • #7657 ffb9ab744 Thanks @mitchellhamilton! - Adds the ability to set ambiguous plurals - like Firmware or Shrimp - as list names without receiving an error. This builds on the existing graphql.plural configuration by adding the configuration options of ui.label, ui.singular, ui.plural and ui.path to change the auto-generated names of lists used in the Admin UI

  • #7578 29db9b5de Thanks @Achisingh! - Adds ui.description for fields to show a description below the label in the Admin UI

Patch Changes

2.0.0

Major Changes

  • #7601 4234ed488 Thanks @dcousens! - upgrade dependancy "react": "^18.1.0"

  • #7601 4234ed488 Thanks @dcousens! - New support for uploading images and files to Amazon S3 and other compatible providers. This is a breaking change, as the .image and .files configuration options have been removed, and a new storage configuration object introduced.

    See #7070 for how to upgrade.

Minor Changes

  • #7591 8add4212c Thanks @dcousens! - Add optional .graphql.bodyParser options object for changing body-parser options when configuring GraphQL

  • #7601 4234ed488 Thanks @dcousens! - Added disconnect to the SessionStrategy API, this allows Keystone to disconnect from the store when using stored sessions. This resolves the testrunner hanging when using stored sessions in automated tests.

  • #7601 4234ed488 Thanks @dcousens! - Removed all Keystone Links, i.e. API explorer, GitHub repository and Keystone documentation, from the popover and replacing the popover button with Sign out button in production

  • #7601 4234ed488 Thanks @dcousens! - Fixed list description from schema to display in the Admin UI

Patch Changes

1.1.1

Patch Changes

1.1.0

Minor Changes

Patch Changes

1.0.1

Patch Changes

1.0.0

Major Changes

  • #7005 7dddbe0fd Thanks @gwyneplaine! - Change cli command from keystone-next to keystone

  • #7028 3c7a581c1 Thanks @mitchellhamilton! - Released Keystone 6

  • #7005 f4554980f Thanks @gwyneplaine! - - The following types have been renamed:

    • BaseGeneratedListTypesBaseListTypeInfo
    • ItemRootValueBaseItem
    • ListInfoListGraphQLTypes
    • TypesForListGraphQLTypesForList
    • FieldTypeFunc now has a required type parameter which must satisfy BaseListTypeInfo
    • The following types now have a required type parameter which must satisfy BaseKeystoneTypeInfo:
      • ServerConfig
      • CreateRequestContext
      • AdminUIConfig
      • DatabaseConfig
      • ListOperationAccessControl
      • MaybeSessionFunction
      • MaybeItemFunction
    • GraphQLResolver and GraphQLSchemaExtension now have a required type parameter which must satisfy KeystoneContext
    • KeystoneGraphQLAPI no longer has a type parameter
    • The first parameter to the resolver in a virtual field will be typed as the item type if the list is typed with Keystone.Lists or Keystone.Lists.ListKey, otherwise it will be typed as unknown
    • The item/originalItem arguments in hooks/access control will now receive the Item type if the list is typed with Keystone.Lists or Keystone.Lists.ListKey, otherwise it will be typed as BaseItem
    • args has been removed from BaseListTypeInfo
    • inputs.orderBy and all has been added to BaseListTypeInfo
    • In .keystone/types:
      • ListKeyListTypeInfo has been moved to Lists.ListKey.TypeInfo
      • KeystoneContext has been renamed to Context

Patch Changes

@keystone-next/keystone

29.0.0

Major Changes

  • #6920 82539faa5 Thanks @mitchellhamilton! - Keystone now uses Prisma's Node-API Query Engine instead of the Binary Query Engine. This should improve the performance of operations using Prisma. See https://www.prisma.io/docs/concepts/components/prisma-engines/query-engine for more details.

  • #6917 04c54a4eb Thanks @mitchellhamilton! - The names of one-sided and two-sided, many-many relationships has been shortened. Two-sided many-many relationship names contain only the left-hand side names now; and the _many suffix has been dropped from one-sided many-many relationships.

    This reduces the probability that you will exceed PostgreSQL's 63 character limit for identifiers with typical usage.

    This is a breaking change.

    There are two ways to update:

    Set db.relationName on many to many relation

    Rather than doing a migration, you can set the new field property db.relationName, for either side of a many-to-many relationship field. If set to the existing relation name, your database will remain unchanged.

    For example, given a schema like this:

    Post: list({
      fields: {
        tags: relationship({ ref: 'Tag.posts', many: true }),
      },
    }),
    Tag: list({
      fields: {
        posts: relationship({ ref: 'Post.tags', many: true }),
      },
    }),

    Before this release, the generated Prisma schema looked like this:

    // This file is automatically generated by Keystone, do not modify it manually.
    // Modify your Keystone config when you want to change this.
    
    datasource postgresql {
      url      = env("DATABASE_URL")
      provider = "postgresql"
    }
    
    generator client {
      provider   = "prisma-client-js"
      output     = "node_modules/.prisma/client"
      engineType = "binary"
    }
    
    model Post {
      id   String @id @default(cuid())
      tags Tag[]  @relation("Post_tags_Tag_posts")
    }
    
    model Tag {
      id    String @id @default(cuid())
      posts Post[] @relation("Post_tags_Tag_posts")
    }

    By adding db: { relationName: 'Post_tags_Tag_posts' } to one side of the many-to-many relationship; you can preclude yourself from a migration.

    Note: It doesn't matter which side of the relationship you put this property, but it should be only on one side; otherwise you will receive an error.

    Post: list({
      fields: {
        tags: relationship({ ref: 'Tag.posts', many: true, db: { relationName: 'Post_tags_Tag_posts' } }),
      },
    }),
    Tag: list({
      fields: {
        posts: relationship({ ref: 'Post.tags', many: true }),
      },
    }),

    Rename your many relation tables using a migration

    For example, given a schema like this:

    Post: list({
      fields: {
        tags: relationship({ ref: 'Tag.posts', many: true }),
      },
    }),
    Tag: list({
      fields: {
        posts: relationship({ ref: 'Post.tags', many: true }),
      },
    }),

    When updating to this change, and running npm run dev, Keystone will prompt you to update your schema.

    • If you are using useMigrations: true, Keystone will follow the typical migration flow offer to apply an automatically generated migration. DO NOT APPLY THE AUTOMATICALLY GENERATED MIGRATION - unless you want to DROP your data.

    • If you are using useMigrations: false, Keystone will follow the typical flow and offer to automatically migrate your schema. Again, DO NOT RUN THE AUTOMATIC MIGRATION - unless you want to DROP your data.

    On PostgreSQL, Prisma will generate a migration that looks something like this:

    /*
      Warnings:
    
      - You are about to drop the `_Post_tags_Tag_posts` table. If the table is not empty, all the data it contains will be lost.
    
    */
    -- DropForeignKey
    ALTER TABLE "_Post_tags_Tag_posts" DROP CONSTRAINT "_Post_tags_Tag_posts_A_fkey";
    
    -- DropForeignKey
    ALTER TABLE "_Post_tags_Tag_posts" DROP CONSTRAINT "_Post_tags_Tag_posts_B_fkey";
    
    -- DropTable
    DROP TABLE "_Post_tags_Tag_posts";
    
    -- CreateTable
    CREATE TABLE "_Post_tags" (
        "A" TEXT NOT NULL,
        "B" TEXT NOT NULL
    );
    
    -- CreateIndex
    CREATE UNIQUE INDEX "_Post_tags_AB_unique" ON "_Post_tags"("A", "B");
    
    -- CreateIndex
    CREATE INDEX "_Post_tags_B_index" ON "_Post_tags"("B");
    
    -- AddForeignKey
    ALTER TABLE "_Post_tags" ADD FOREIGN KEY ("A") REFERENCES "Post"("id") ON DELETE CASCADE ON UPDATE CASCADE;
    
    -- AddForeignKey
    ALTER TABLE "_Post_tags" ADD FOREIGN KEY ("B") REFERENCES "Tag"("id") ON DELETE CASCADE ON UPDATE CASCADE;

    You need to modify it so that it looks like this with the old and new table names for your schema substituted:

    ALTER TABLE "_Post_tags_Tag_posts" RENAME TO "_Post_tags";
    ALTER INDEX "_Post_tags_Tag_posts_AB_unique" RENAME TO "_Post_tags_AB_unique";
    ALTER INDEX "_Post_tags_Tag_posts_B_index" RENAME TO "_Post_tags_B_index";
    ALTER TABLE "_Post_tags" RENAME CONSTRAINT "_Post_tags_Tag_posts_A_fkey" TO "_Post_tags_A_fkey";
    ALTER TABLE "_Post_tags" RENAME CONSTRAINT "_Post_tags_Tag_posts_B_fkey" TO "_Post_tags_B_fkey";

    On SQLite, Prisma will generate a migration that looks something like this:

    /*
      Warnings:
    
      - You are about to drop the `_Post_tags_Tag_posts` table. If the table is not empty, all the data it contains will be lost.
    
    */
    -- DropTable
    PRAGMA foreign_keys=off;
    DROP TABLE "_Post_tags_Tag_posts";
    PRAGMA foreign_keys=on;
    
    -- CreateTable
    CREATE TABLE "_Post_tags" (
        "A" TEXT NOT NULL,
        "B" TEXT NOT NULL,
        FOREIGN KEY ("A") REFERENCES "Post" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
        FOREIGN KEY ("B") REFERENCES "Tag" ("id") ON DELETE CASCADE ON UPDATE CASCADE
    );
    
    -- CreateIndex
    CREATE UNIQUE INDEX "_Post_tags_AB_unique" ON "_Post_tags"("A", "B");
    
    -- CreateIndex
    CREATE INDEX "_Post_tags_B_index" ON "_Post_tags"("B");

    You need to modify it so that it looks like this with the old and new table names for your schema substituted:

    ALTER TABLE "_Post_tags_Tag_posts" RENAME TO "_Post_tags";
    DROP INDEX "_Post_tags_Tag_posts_AB_unique";
    DROP INDEX "_Post_tags_Tag_posts_B_index";
    CREATE UNIQUE INDEX "_Post_tags_AB_unique" ON "_Post_tags"("A", "B");
    CREATE INDEX "_Post_tags_B_index" ON "_Post_tags"("B");
  • #6957 de8cf44e7 Thanks @bladey! - Update Node engines to support current Node LTS versions, currently versions 14 and 16.

Minor Changes

  • #6968 f2b41df9f Thanks @JedWatson! - Added db.foreignKey option to the relationship field that allows you to explicitly pick which side of a one to one relationship the foreign key should be on and for one to one or one to many relationships add @map to the foreign key to change the column name in the database.

  • #6917 04c54a4eb Thanks @mitchellhamilton! - Added db.relationName option to many to many relationship fields to allow explicitly setting the relation name.

Patch Changes

28.0.0

Major Changes

  • #6915 b981f4c3e Thanks @mitchellhamilton! - select, timestamp, float and decimal fields with isIndexed: 'unique' now add unique filters to ListWhereUniqueInput like text, integer and the id field do.

Minor Changes

  • #6907 990b56291 Thanks @JedWatson! - Added db.map option to lists and fields which adds the @@map and @map Prisma attributes respectively

Patch Changes

27.0.2

Patch Changes

27.0.1

Patch Changes

  • #6870 8dac6bb93 Thanks @mitchellhamilton! - Fixed files with names including things like [...rest] created using ui.getAdditionalFiles being deleted after being written in dev.

  • #6880 400f4e1eb Thanks @mitchellhamilton! - Runtime type errors from Prisma are now actually returned instead of being returned as Prisma error:

  • #6872 aa98b1c49 Thanks @mitchellhamilton! - Fixed Schema must contain uniquely named types but contains multiple types named "OrderDirection". error when running keystone-next build.

27.0.0

Major Changes

  • #6824 ddabdbd02 Thanks @mitchellhamilton! - Keystone will now default to using GraphQL Playground instead of Apollo Sandbox as it did prior to updating to Apollo Server 3. If you want to use Apollo Sandbox, you can set graphql.playground: 'apollo' to use Apollo. graphql.playground defaults to process.env.NODE_ENV !== 'production', which will serve GraphQL Playground in development and serve nothing in production, if you'd like to set it to one of those always, you can set graphql.playground to a boolean explicitly.

  • #6845 71600965b Thanks @mitchellhamilton! - Added CloudImageFieldOutput and CloudFileFieldOutput GraphQL types to the image and file fields respectively

  • #6789 d9e1ba8fa Thanks @mitchellhamilton! - Removed the deprecated resolveFields from context.query, if you were still using it, you should switch to providing the query option to context.query or use context.db if you were providing false. The context.query functions will now also throw an error if an empty string is passed to query rather than silently returning what the context.db functions return, you must select at least one field or omit the query option to default to selecting the id.

  • #6845 71600965b Thanks @mitchellhamilton! - The src field on the output of image and file fields has been renamed to url.

  • #6813 c0661b8ee Thanks @mitchellhamilton! - Updated @graphql-ts/schema to 0.5.0. The __rootVal properties on ObjectType, InterfaceType and UnionType have been renamed to __source, this is intended to be internal but it could be depended on so if you did, you will need to change to __source. The fields property on InterfaceType has been renamed to __fields and it will no longer exist at runtime like the other types.

  • #6797 cbb9df927 Thanks @mitchellhamilton! - createExpressServer now returns Promise<{ expressServer: Express; apolloServer: ApolloServer; }> instead of Promise<Express> so that the apollo server can be stopped.

  • #6797 cbb9df927 Thanks @mitchellhamilton! - Added live reloading of your Keystone config to keystone-next dev

  • #6824 ddabdbd02 Thanks @mitchellhamilton! - Removed graphql.cors option. You should exclusively configure cors with the server.cors option.

  • #6845 71600965b Thanks @mitchellhamilton! - The getSrc function on ImagesContext and FilesContext has been renamed to getUrl

  • #6755 dcf5241d8 Thanks @mitchellhamilton! - Updated the way the endSession field on the Mutation type and the keystone field on the Query type are added to the GraphQL schema. This may result in re-ordering in your generated schema.graphql file. The sessionSchema export of @keystone-next/keystone/session has also been removed.

Minor Changes

Patch Changes

26.1.1

Patch Changes

  • #6774 d67066e6d Thanks @bladey! - Fixed text, integer, float and decimal on the item view when using ui.itemView.fieldMode: 'read'.

26.1.0

Minor Changes

  • #6746 d64bd4a7f Thanks @timleslie! - The following config functions now also access a context argument:

    • list.ui.isHidden
    • list.ui.hideCreate
    • list.ui.hideDelete
    • list.ui.createView.defaultFieldMode
    • list.ui.itemView.defaultFieldMode
    • list.ui.listView.defaultFieldMode
    • field.ui.createView.fieldMode
    • field.ui.itemView.fieldMode
    • field.ui.listView.fieldMode
  • #6743 abeceaf90 Thanks @timleslie! - Added custom error codes to all GraphQL errors to support easier debugging and processing of errors.

Patch Changes

26.0.1

Patch Changes

26.0.0

Major Changes

  • #6680 5c0163e09 Thanks @timleslie! - Renamed the originalInput argument for access control functions to inputData.

  • #6638 7f5caff60 Thanks @mitchellhamilton! - In the select field, dataType has been renamed to type, defaultValue is now a static value and isRequired has moved to validation.isRequired. The select field can also be made non-nullable at the database-level with the db.isNullable option which defaults to validation.isRequired ? false : true. graphql.read.isNonNull can also be set if the field is non-nullable in the database and you have no read access control and you don't intend to add any in the future, it will make the GraphQL output field non-nullable. graphql.create.isNonNull can also be set if you have no create access control and you don't intend to add any in the future, it will make the GraphQL create input field non-nullable. The select can now also be cleared in the Admin UI when ui.displayMode is segmented-control.

  • #6663 480c875d1 Thanks @mitchellhamilton! - In the decimal field, defaultValue is now a static number written as a string, isRequired has moved to validation.isRequired and now also requires the input isn't NaN, along with new validation.min and validation.max options. The decimal field can also be made non-nullable at the database-level with the db.isNullable option which defaults to validation.isRequired ? false : true. graphql.read.isNonNull can also be set if the field is non-nullable in the database and you have no read access control and you don't intend to add any in the future, it will make the GraphQL output field non-nullable. graphql.create.isNonNull can also be set if you have no create access control and you don't intend to add any in the future, it will make the GraphQL create input field non-nullable.

  • #6409 3ece149e5 Thanks @timleslie! - Upgraded Apollo Server to Version 3.

    The Apollo documentation contains a full list of breaking changes introduced by this update. You can configure the Apollo Server provided by Keystone using the graphql.apolloConfig configuration option.

    The most prominant change for most users will be that the GraphQL Playground has been replaced by the Apollo Sandbox. If you prefer to keep the GraphQL Playground, you can configure your server by following these instructions.

  • #6587 8bbba49c7 Thanks @mitchellhamilton! - The KeystoneAdminUIFieldMeta.isOrderable and KeystoneAdminUIFieldMeta.isFilterable fields are no longer statically resolvable and will now take into account the context/session. This also means isOrderable and isFilterable are no longer accessible on useList().fields[fieldKey].isOrderable/isFilterable, they can be fetched through GraphQL if you need them in the Admin UI.

  • #6607 42268ee72 Thanks @mitchellhamilton! - Removed isRequired and defaultValue can no longer be dynamic in the json field. If you were using isRequired, the same behaviour can be re-created with the validateInput hook.

  • #6461 e81947d6c Thanks @mitchellhamilton! - In the text field, defaultValue is now a static value, isRequired has moved to validation.isRequired and also requires that the value has a length of at least one, along with new validation.lenght.min, validation.length.max and validation.match options. The text field is also now non-nullable at the database-level by default and can be made nullable by setting the db.isNullable option to true. graphql.read.isNonNull can also be set if the field does not have db.isNullable: true and you have no read access control and you don't intend to add any in the future, it will make the GraphQL output field non-nullable. graphql.create.isNonNull can also be set if you have no create access control and you don't intend to add any in the future, it will make the GraphQL create input field non-nullable.

  • #6691 5d3fc0b77 Thanks @mitchellhamilton! - Removed __legacy property from field type implementations

  • #6518 0218a4215 Thanks @timleslie! - Removed the deprecated config.db.adapter option. Please use config.db.provider to indicate the database provider for your system.

  • #6684 14bfa8a9b Thanks @timleslie! - * Consolidated the beforeChange/beforeDelete and afterChange/afterDelete hooks into beforeOperation and afterOperation.

    • Renamed the existingItem argument for all hooks (except afterOperation) to item.
    • Renamed the existingItem argument for afterOperation to originalItem.
    • Renamed the updatedItem argument for afterOperation to item.

    See the Hooks API docs for a complete reference for the updated API.

  • #6535 581e130cf Thanks @timleslie! - The API context.lists has been renamed to context.query, and context.db.lists has been renamed to context.db.

    When using the experimental option config.experimental.generateNodeAPI, the api module now exports query rather than lists.

  • #6674 f963966ab Thanks @mitchellhamilton! - In the timestamp field, defaultValue is now a static date time value in an ISO8601 string or { kind: 'now' } and isRequired has moved to validation.isRequired. The timestamp field can also be made non-nullable at the database-level with the db.isNullable option which defaults to validation.isRequired ? false : true. graphql.read.isNonNull can also be set if the field is non-nullable in the database and you have no read access control and you don't intend to add any in the future, it will make the GraphQL output field non-nullable. graphql.create.isNonNull can also be set if you have no create access control and you don't intend to add any in the future, it will make the GraphQL create input field non-nullable. The field can also be automatically set to the current time on a create/update by setting db.updatedAt: true, this will add Prisma's @updatedAt attribute to the field. The timestamp field also now uses a custom GraphQL scalar type named DateTime which requires inputs as full ISO8601 date-time strings such as "2021-01-30T00:00:00.000Z", using new Date().toISOString() will give you a string in the correct format.

  • #6683 b76974736 Thanks @mitchellhamilton! - In the password field, defaultValue has been removed, isRequired has moved to validation.isRequired, rejectCommon has moved to validation.rejectCommon, minLength has moved to validation.length.min along with with the new validation.length.max and validation.match options. The password field can also be made non-nullable at the database-level with the db.isNullable option which defaults to validation.isRequired ? false : true. Also, providing '' to the field will now result in an error instead of silently setting null. validation.length.min also must be 1 or above, though it still defaults to 8. If workFactor is outside of the range of 6 to 31, an error will now be thrown instead of the previous behaviour of clamping the value to 4 to 31 and warning if it's below 6.

  • #6542 47c8b53ce Thanks @mitchellhamilton! - Removed createSchema function, you can remove the call to createSchema and pass the lists directly to the lists property

  • #6520 1b0a2f516 Thanks @timleslie! - Removed context.schemaName from the context object. This value was an internal API which is no longer required.

  • #6689 67492f37d Thanks @mitchellhamilton! - Moved graphql export of @keystone-next/keystone/types to @keystone-next/keystone

  • #6656 002e1d88b Thanks @Noviny! - In the float field, defaultValue is now a static number, isRequired has moved to validation.isRequired, along with new validation.min and validation.max options. The float field can also be made non-nullable at the database-level with the db.isNullable option which defaults to validation.isRequired ? false : true. graphql.read.isNonNull can also be set if the field is non-nullable in the database and you have no read access control and you don't intend to add any in the future, it will make the GraphQL output field non-nullable. graphql.create.isNonNull can also be set if you have no create access control and you don't intend to add any in the future, it will make the GraphQL create input field non-nullable.

  • #6490 ca48072b4 Thanks @renovate! - Updated Prisma package dependencies to 3.0.2. See the Prisma release notes for full details of the changes.

    Note that Keystone continues to use the "binary" query engine, rather than the new "node-API" query engine, which is now the Prisma default. We are still performing tests to ensure that the node-API query engine will work well with Keystone.

  • #6588 3b9732acd Thanks @mitchellhamilton! - In the integer field, defaultValue is now a static number or { kind: 'autoincrement' }, isRequired has moved to validation.isRequired, along with new validation.min and validation.max options. The integer field can also be made non-nullable at the database-level with the db.isNullable option which defaults to validation.isRequired ? false : true. graphql.read.isNonNull can also be set if the field is non-nullable in the database and you have no read access control and you don't intend to add any in the future, it will make the GraphQL output field non-nullable. graphql.create.isNonNull can also be set if you have no create access control and you don't intend to add any in the future, it will make the GraphQL create input field non-nullable.

    The autoIncrement field has also been removed, use the integer field with a defaultValue of { kind: 'autoincrement' }

  • #6448 c2b124f8e Thanks @mitchellhamilton! - The checkbox field is now non-nullable in the database, if you need three states, you should use select(). The field no longer accepts dynamic default values and it will default to false unless a different defaultValue is specified. graphql.read.isNonNull can also be set if you have no read access control and you don't intend to add any in the future, it will make the GraphQL output field non-nullable. graphql.create.isNonNull can also be set if you have no create access control and you don't intend to add any in the future, it will make the GraphQL create input field non-nullable.

    If you're using SQLite, Prisma will generate a migration that makes the column non-nullable and sets any rows that have null values to the defaultValue.

    If you're using PostgreSQL, Prisma will generate a migration but you'll need to modify it if you have nulls in a checkbox field. Keystone will say that the migration cannot be executed:

    ✨ Starting Keystone
    ⭐️ Dev Server Ready on http://localhost:3000
    ✨ Generating GraphQL and Prisma schemas
    ✨ There has been a change to your Keystone schema that requires a migration
    
    ⚠️ We found changes that cannot be executed:
    
      • Made the column `isAdmin` on table `User` required, but there are 1 existing NULL values.
    
    ✔ Name of migration … make-is-admin-non-null
    ✨ A migration has been created at migrations/20210906053141_make_is_admin_non_null
    Please edit the migration and run keystone-next dev again to apply the migration

    The generated migration will look like this:

    /*
      Warnings:
    
      - Made the column `isAdmin` on table `User` required. This step will fail if there are existing NULL values in that column.
    
    */
    -- AlterTable
    ALTER TABLE "User" ALTER COLUMN "isAdmin" SET NOT NULL,
    ALTER COLUMN "isAdmin" SET DEFAULT false;

    To make it set any null values to false in your database, you need to modify it so that it looks like this but with the table and column names replaced.

    ALTER TABLE "User" ALTER COLUMN "isAdmin" SET DEFAULT false;
    UPDATE "User" SET "isAdmin" = DEFAULT WHERE "isAdmin" IS NULL;
    ALTER TABLE "User" ALTER COLUMN "isAdmin" SET NOT NULL;
  • #6513 4048991ba Thanks @mitchellhamilton! - Removed isRequired and defaultValue from the image and file fields. If you were using these options, the same behaviour can be re-created with the validateInput and resolveInput hooks respectively.

  • #6514 79e2cc3aa Thanks @mitchellhamilton! - Removed defaultValue and the undocumented withMeta option from the relationship field. To re-create defaultValue, you can use resolveInput though note that if you're using autoincrement ids, you need to return the id as number, not a string like you would provide to GraphQL, e.g. { connect: { id: 1 } } rather than { connect: { id: "1" } }. If you were using withMeta: false, please open an issue with your use case.

  • #6707 1f952fb10 Thanks @timleslie! - Changed the default for defaultIsFilterable and defaultIsOrderable from false to true. This means that all fields are filterable and orderable by default. Filtering can be disabled by setting either defaultIsFilterable: false at the list level, or isFilterable: false at the field level. Ordering can be disabled by setting either defaultIsOrderable: false at the list level, or isOrderable: false at the field level.

  • #6520 1b0a2f516 Thanks @timleslie! - Renamed the skipAccessControl argument to createContext to sudo for consistency with context.sudo().

  • #6538 4e485a914 Thanks @mitchellhamilton! - Renamed graphQLReturnFragment to ui.query in the virtual field options. The virtual field now checks if ui.query is required for the GraphQL output type, and throws an error if it is missing. If you don't want want the Admin UI to fetch the field, you can set ui.itemView.fieldMode and ui.listView.fieldMode to 'hidden' instead of providing ui.query.

  • #6490 ca48072b4 Thanks @renovate! - Removed filters.postgresql.Json export from @keystone-next/keystone/types. Note this is unrelated to the json field type. The json field type did not have filters and still does not.

  • #6681 c8aca958b Thanks @timleslie! - Renamed the originalInput argument for hook functions to inputData.

  • #6519 838845298 Thanks @mitchellhamilton! - The Admin UI will skip fetching fields that have a statically set itemView.fieldMode: 'hidden' on the item view. The id argument to the KeystoneAdminUIFieldMeta.itemView GraphQL field can now be omitted which will make KeystoneAdminUIFieldMetaItemView.fieldMode return null when there isn't a static field mode. The itemView also no longer uses a sudo context when fetching the item in the KeystoneAdminUIFieldMetaItemView.fieldMode. Previously, if someone had access to the Admin UI(ui.isAccessAllowed) and a field had a itemView.fieldMode function that used the item argument, someone could bypass access control to determine whether or not an item with a given id exists.

Minor Changes

  • #6560 a95da1d81 Thanks @timleslie! - Added support for dynamic isFilterable and isOrderable field config values. If a function is provided for these config option, it will be dynamically evaluated each time the field is used for filtering and ordering, and an error will be returned if the function returns false.

  • #6574 3ee4542a8 Thanks @Nikitoring! - Added support for Prisma preview features via the config.db.prismaPreviewFeatures configuration option.

  • #6608 e747ef6f3 Thanks @gwyneplaine! - * Added Filter functionality to relationships.

    • Added portalMenu prop to the RelationshipSelect and updated it to not portal the menu by default.
  • #6616 232c512a0 Thanks @timleslie! - Added a createContext argument to the config.server.extendExpressApp option, allowing access to the full context API.

  • #6564 b6c8c3bff Thanks @mitchellhamilton! - Added dbFieldConfig parameter to jsonFieldTypePolyfilledForSQLite

Patch Changes

25.0.4

Patch Changes

25.0.3

Patch Changes

  • 7b7956428 Thanks @timleslie! - Fixed Relationship field inline connect throwing 400 errors when selecting a value.

25.0.2

Patch Changes

  • #6507 847f6f046 Thanks @timleslie! - Fixed an issue where the incorrect value for the operation argument was passed into field-level access control functions. Keystone now correctly passes in 'read' rather than the incorrect 'query'.

  • #6507 69b4332a7 Thanks @timleslie! - Fixed windows issues with new view resolver from #6414.

  • #6507 b3a77c311 Thanks @timleslie! - Fixed item form submitting an invalid request after saving returns errors

25.0.1

Patch Changes

25.0.0

Major Changes

  • #6377 3008c5110 Thanks @mitchellhamilton! - Moved exports of @keystone-next/keystone to @keystone-next/keystone/system

  • #6323 3904a9cf7 Thanks @mitchellhamilton! - Removed unused legacy filter code

  • #6414 32f024738 Thanks @mitchellhamilton! - Updated to Next.js 11. If you were using a custom Babel config, it will no longer be respected because of changes in Next.js.

  • #6393 ee54522d5 Thanks @mitchellhamilton! - Updated @graphql-ts/schema to 0.3.0 and moved the schema export to @keystone-next/keystone entrypoint and renamed it to graphql. bindSchemaAPIToContext on the graphql export has also been renamed to bindGraphQLSchemaAPIToContext.

  • #6426 8f2786535 Thanks @timleslie! - Update the Access Control API. This is a breaking change which impacts the security of all Keystone systems.

    See the Access Control API for a full description of the new API.

  • #6420 0aa02a333 Thanks @timleslie! - Added the config option graphql.omit to list and field level configuration to control which types and operations are excluded from the GraphQL API. The use of a static false value in access control definitions no longer excludes operations from the GraphQL API.

  • #6455 bf9b5605f Thanks @timleslie! - The fieldPath argument to field hooks has been renamed to fieldKey. This makes the naming consistent with the Access Control APIs.

  • #6463 3957c0981 Thanks @JedWatson! - The GraphQL API endpoint now starts up significantly faster in Dev.

    To facilitate this, createExpressServer no longer includes the step of creating the Admin UI Middleware, which changes its signature. createAdminUIMiddleware is now also exported from @keystone-next/keystone/system.

  • #6437 af5e59bf4 Thanks @mitchellhamilton! - Changed isUnique: true config in fields to isIndexed: 'unique'

  • #6420 0aa02a333 Thanks @timleslie! - Filtering and ordering is no longer enabled by default, as they have the potential to expose data which would otherwise be protected by access control. To enable filtering and ordering you can set isFilterable: true and isOrderable: true on specific fields, or set defaultIsFilterable: true and defaultIsOrderable: true at the list level.

  • #6378 489e128fe Thanks @mitchellhamilton! - Moved exports of @keystone-next/keystone/schema to @keystone-next/keystone

Minor Changes

  • #6403 2a901a121 Thanks @timleslie! - Added the experimental config option config.experimental.contextInitialisedLists, which adds the internal data structure experimental.initialisedLists to the context object. This is a temporary addition to the API which will be removed in a future release once a more controlled API is available. It should be used with caution, as it will contain breaking change in patch level releases.

  • #6371 44f2ef60e Thanks @mitchellhamilton! - Moved @keystone-next/types to @keystone-next/keystone/types

  • #6367 4f36a81af Thanks @mitchellhamilton! - Moved @keystone-next/admin-ui-utils to @keystone-next/keystone/admin-ui/utils

  • #6361 595922b48 Thanks @mitchellhamilton! - Moved exports of @keystone-next/testing to @keystone-next/keystone/testing

  • #6368 783290796 Thanks @mitchellhamilton! - Moved @keystone-next/utils to @keystone-next/keystone/fields/types/image/utils for image ref related utilities and @keystone-next/keystone/fields/types/file/utils for file ref related utilities.

  • #6458 944bce1e8 Thanks @timleslie! - Added the config option config.graphql.path to configure the endpoint of the GraphQL API (default '/api/graphql').

  • #6467 e0f935eb2 Thanks @JedWatson! - Add extendExpressApp config option for configuring the express app that Keystone creates

  • #6459 f2311781a Thanks @timleslie! - Updated Navigation component to show docs and playground links irrespective of authentication.

  • #6362 fd744dcaa Thanks @mitchellhamilton! - Moved @keystone-next/fields to @keystone-next/keystone/fields

Patch Changes

24.0.1

Patch Changes

24.0.0

Major Changes

  • #6196 5cd8ffd6c Thanks @mitchellhamilton! - Removed _ListKeyMeta and _toManyRelationshipFieldMeta fields. You should use listKeyCount and toManyRelationshipFieldCount instead

  • #6196 5cd8ffd6c Thanks @mitchellhamilton! - Removed all arguments from context.lists.List.count and context.db.lists.List.count except for where.

  • #6266 b696a9579 Thanks @mitchellhamilton! - Renamed first argument in find many queries to take to align with Prisma.

    type Query {
      users(
        where: UserWhereInput! = {}
        orderBy: [UserOrderByInput!]! = []
        # previously was first: Int
        take: Int
        skip: Int! = 0
      ): [User!]
      # ...
    }
    
    type User {
      # ...
      posts(
        where: PostWhereInput! = {}
        orderBy: [PostOrderByInput!]! = []
        # previously was first: Int
        take: Int
        skip: Int! = 0
      ): [Post!]
      # ...
    }
  • #6208 092df6678 Thanks @mitchellhamilton! - The create one mutation now requires a non-null data argument and the create many mutation accepts a list of ItemCreateInput directly instead of being nested inside of an object with the ItemCreateInput in a data field.

    If you have a list called Item, createItem now looks like createItem(data: ItemCreateInput!): Item and createItems now looks like createItems(data: [ItemCreateInput!]!): [Item].

  • #6196 5cd8ffd6c Thanks @mitchellhamilton! - Removed search argument from the GraphQL API for finding many items, Lists/DB API and to-many relationship fields. You should use contains filters instead.

  • #6095 272b97b3a Thanks @mitchellhamilton! - Updated filters to be nested instead of flattened and add top-level NOT operator. See the Query Filter API docs and the upgrade guide for more information.

    query {
      posts(where: { title: { contains: "Something" } }) {
        title
        content
      }
    }
  • #6198 9d361c1c8 Thanks @timleslie! - Removed the uid and name properties from the errors returned by the GraphQL API.

  • #6196 5cd8ffd6c Thanks @mitchellhamilton! - Removed sortBy argument from the GraphQL API for finding many items, Lists/DB API and to-many relationship fields. You should use orderBy instead.

  • #6312 56044e2a4 Thanks @mitchellhamilton! - Updated @graphql-ts/schema. The second type parameter of schema.Arg exported from @keystone-next/types is now a boolean that defines whether or not the arg has a default value to make it easier to define circular input objects.

  • #6217 874f2c405 Thanks @mitchellhamilton! - disconnectAll has been renamed to disconnect in to-one relationship inputs and the old disconnect field has been removed. There are also seperate input types for create and update where the input for create doesn't have disconnect. It's also now required that if you provide a to-one relationship input, you must provide exactly one field to the input.

    If you have a list called Item, the to-one relationship inputs now look like this:

    input ItemRelateToOneForCreateInput {
      create: ItemCreateInput
      connect: ItemWhereUniqueInput
    }
    input ItemRelateToOneForUpdateInput {
      create: ItemCreateInput
      connect: ItemWhereUniqueInput
      disconnect: Boolean
    }
  • #6224 3564b342d Thanks @mitchellhamilton! - disconnectAll has been replaced by set in to-many relationship inputs, the equivalent to disconnectAll: true is now set: []. There are also seperate input types for create and update where the input for create doesn't have disconnect or set. The inputs in the lists in the input field are now also non-null.

    If you have a list called Item, the to-many relationship inputs now look like this:

    input ItemRelateToManyForCreateInput {
      create: [ItemCreateInput!]
      connect: [ItemWhereUniqueInput!]
    }
    input ItemRelateToManyForUpdateInput {
      disconnect: [ItemWhereUniqueInput!]
      set: [ItemWhereUniqueInput!]
      create: [ItemCreateInput!]
      connect: [ItemWhereUniqueInput!]
    }
  • #6197 4d9f89f88 Thanks @mitchellhamilton! - The generated CRUD queries, and some of the input types, in the GraphQL API have been renamed.

    If you have a list called Item, the query for multiple values, allItems will be renamed to items. The query for a single value, Item, will be renamed to item.

    Also, the input type used in the updateItems mutation has been renamed from ItemsUpdateInput to ItemUpdateArgs.

  • #6211 d214e2f72 Thanks @mitchellhamilton! - The update mutations now accept where unique inputs instead of only an id and the where and data arguments are non-null.

    If you have a list called Item, the update mutations now look like this:

    type Mutation {
      updateItem(where: ItemWhereUniqueInput!, data: ItemUpdateInput!): Item
      updateItems(data: [ItemUpdateArgs!]!): [Item]
    }
    
    input ItemUpdateArgs {
      where: ItemWhereUniqueInput!
      data: ItemUpdateInput!
    }
  • #6206 f5e64af37 Thanks @mitchellhamilton! - The delete mutations now accept where unique inputs instead of only an id.

    If you have a list called Item, deleteItem now looks like deleteItem(where: ItemWhereUniqueInput!): Item and deleteItems now looks like deleteItems(where: [ItemWhereUniqueInput!]!): [Item]

Minor Changes

  • #6276 3a7a06b2c Thanks @gautamsi! - Added option for Bearer token auth when using session.

  • #6267 1030296d1 Thanks @timleslie! - Added config.graphql.debug option, which can be used to control whether debug information such as stack traces are included in the errors returned by the GraphQL API.

Patch Changes

23.0.3

Patch Changes

23.0.2

Patch Changes

23.0.1

Patch Changes

23.0.0

Major Changes

  • #6153 7716315ea Thanks @mitchellhamilton! - Removed implicit chunking from the lists API so that the lists API is a direct translation of the GraphQL API

  • #6105 e5f61ad50 Thanks @mitchellhamilton! - Removed unnecessary descriptions on GraphQL types.

  • #6165 e4e6cf9b5 Thanks @mitchellhamilton! - Added ui.searchFields option to lists to allow searching by multiple fields in the Admin UI (the only current usage of this is in the select used in relationship fields) and to replace the usage of the search GraphQL argument which will be removed soon and should be replaced by using contains filters directly.

Minor Changes

  • #6111 9e2deac5f Thanks @gwyneplaine! - Added the ability to customise the Navigation component in the Admin UI, and provided helper components to do so.

Patch Changes

22.0.0

Major Changes

Patch Changes

21.0.2

Patch Changes

21.0.1

Patch Changes

21.0.0

Major Changes

  • #5947 03f535ba6 Thanks @mitchellhamilton! - Replaced the idField list configuration option with a more constrained option, db.idField, that accepts an object with a kind property with a value of cuid, uuid or autoincrement. db.idField can be set on either the top level config object, or on individual lists.

    The default behaviour has changed from using autoincrement to using cuids. To keep the current behaviour, you should set { kind: 'autoincrement' } at db.idField in your top level config.

  • #5947 03f535ba6 Thanks @mitchellhamilton! - Id field filters no longer allow null to be passed because ids can never be null. For the in and not_in, this is reflected in the GraphQL types

Patch Changes

20.0.1

Patch Changes

20.0.0

Major Changes

  • #5665 a3b07ea16 Thanks @mitchellhamilton! - The ordering of types in the generated schema.graphql has changed due to the re-implementation of the core of Keystone, you will need to run keystone-next dev/keystone-next postinstall --fix to update it.

  • #5665 a3b07ea16 Thanks @mitchellhamilton! - createSystem no longer accepts a Prisma client directly and it returns getKeystone which accepts the generated Prisma client and returns connect, disconnect and createContext instead of returning a keystone instance object.

  • #5665 a3b07ea16 Thanks @mitchellhamilton! - The core of Keystone has been re-implemented to make implementing fields and new features in Keystone easier. While the observable changes for most users should be minimal, there could be breakage. If you implemented a custom field type, you will need to change it to the new API, see fields in the @keystone-next/fields package for inspiration on how to do this.

  • #5665 a3b07ea16 Thanks @mitchellhamilton! - The ordering of relationships fields in the generated Prisma schema has changed so that it aligns with the order specified in the list config with the opposites to one-sided relationships added at the end. The name of one-to-one and one-to-many relationships has also changed to include _ between the list key and field key to align with many-to-many relationships. Note that these changes do not require a migration, only your schema.prisma file will need to be updated with keystone-next dev/keystone-next postinstall --fix.

  • #5665 a3b07ea16 Thanks @mitchellhamilton! - The id field on the item returned from context.db.lists functions/passed to hooks/field type resolvers is now whatever the actual id field returned from Prisma is rather than a stringified version of it.

  • #5665 a3b07ea16 Thanks @mitchellhamilton! - Replaced graphql.itemQueryName with always using the list key as the singular name in GraphQL and renamed graphql.listQueryName to graphql.plural

  • #5665 a3b07ea16 Thanks @mitchellhamilton! - The KeystoneContext type no longer has the keystone object or functions to run access control.

  • #5665 a3b07ea16 Thanks @mitchellhamilton! - List level create, update and delete access control is now called for each operation in a many operation rather than on all of the operations as a whole. This means that rather than recieving originalInput as an array with itemIds, your access control functions will always be called with just an itemId and/or originalInput(depending on which access control function it is). If your access control functions already worked with creating/updating/deleting one item, they will continue working (though you may get TypeScript errors if you were previously handling itemIds and originalInput as an array, to fix that, you should stop handling that case).

  • #5891 97fd5e05d Thanks @mitchellhamilton! - Added support for filtering uniquely by text and integer fields that have isUnique: true like this:

    query {
      Post(where: { slug: "something-something-something" }) {
        id
        title
        content
      }
    }
  • #5665 a3b07ea16 Thanks @mitchellhamilton! - Filters returned from access control now go through GraphQL validation and coercion like filters that you pass in through the GraphQL API, this will produce better errors when you return invalid values.

Minor Changes

Patch Changes

19.0.0

Major Changes

  • #5806 0eadba2ba Thanks [@list({](https://github.com/list({), [@list({](https://github.com/list({)! - Removed withItemData in favour of a sessionData option to the createAuth() function.

    Previously, withItemData would be used to wrap the config.session argument:

    import { config, createSchema, list } from '@keystone-next/keystone/schema';
    import { statelessSessions, withAuthData } from '@keystone-next/keystone/session';
    import { text, password, checkbox } from '@keystone-next/fields';
    import { createAuth } from '@keystone-next/auth';
    
    const { withAuth } = createAuth({
      listKey: 'User',
      identityField: 'email',
      secretField: 'password',
    });
    
    const session = statelessSessions({ secret: '-- EXAMPLE COOKIE SECRET; CHANGE ME --' });
    
    export default withAuth(
      config({
        lists: createSchema({
    
            fields: {
              email: text({ isUnique: true }),
              password: password(),
              isAdmin: checkbox(),
            },
          }),
          session: withItemData(session, { User: 'id isAdmin' }),
        }),
      })
    );

    Now, the fields to populate are configured on sessionData in createAuth, and withItemData is completely removed.

    import { config, createSchema, list } from '@keystone-next/keystone/schema';
    import { statelessSessions } from '@keystone-next/keystone/session';
    import { text, password, checkbox } from '@keystone-next/fields';
    import { createAuth } from '@keystone-next/auth';
    
    const { withAuth } = createAuth({
      listKey: 'User',
      identityField: 'email',
      secretField: 'password',
      sessionData: 'id isAdmin',
    });
    
    const session = statelessSessions({ secret: '-- EXAMPLE COOKIE SECRET; CHANGE ME --' });
    
    export default withAuth(
      config({
        lists: createSchema({
    
            fields: {
              email: text({ isUnique: true }),
              password: password(),
              isAdmin: checkbox(),
            },
          }),
          session,
        }),
      })
    );
  • #5772 f52079f0b Thanks @timleslie! - Fixed the behaviour of createItems, updateItems, and deleteItems mutations to be consistent and predictable.

    Previously, these mutations could return items in an arbitrary order. They now return items in the same order they were provided to the mutation.

    Previously, if there was an error, say a validation error, on one or more of the items then the return value would be null and a single top level error would be returned. The state of the database in this case was non-deterministic.

    The new behaviour is to return values for all items created, with null values for those that had errors. These errors are returned in the errors array and have paths which correctly point to the null values in the returned array. All the valid operations will be completed, leaving the database in a deterministic state.

    Previously, if items were filtered out by declarative access control, then no error would be returned, and only those accessible items would be returned. Now the returned data will contain null values for those items which couldn't accessed, and the errors array will contain errors with paths which correctly point to the null values in the returned array.

    Previously, if static access control denied access to the mutation, then null was returned, and a single error was returned. Now, an array of nulls is returned, with a separate error for each object. This makes the behaviour of static and declarative access control consistent.

  • #5777 74bc77854 Thanks @timleslie! - Updated the type of the skip argument to allItems from Int to Int! = 0.

  • #5792 319c19bd5 Thanks @timleslie! - Changed the type of the where argument to allItems to _allItemsMeta from type ItemWhereInput to ItemWhereInput! = {}.

  • #5832 195d4fb12 Thanks @timleslie! - Updated the functions getCommittedArtifacts, validateCommittedArtifacts, generateCommittedArtifacts, and generateNodeModulesArtifacts exported from artifacts.ts to accept a KeystoneConfig argument rather than a BaseKeystone object.

  • #5850 5b02e8625 Thanks @timleslie! - The AND and OR operators of ItemWhereInput now accept non-null values, e.g. [ItemWhereInput!], rather than [ItemWhereInput].

  • #5767 02af04c03 Thanks @timleslie! - Deprecated the sortBy GraphQL filter. Updated the orderBy GraphQL filter with an improved API.

    Previously a User list's allUsers query would have the argument:

    orderBy: String

    The new API gives it the argument:

    orderBy: [UserOrderByInput!]! = []

    where

    input UserOrderByInput {
      id: OrderDirection
      name: OrderDirection
      score: OrderDirection
    }
    
    enum OrderDirection {
      asc
      desc
    }

    Rather than writing allUsers(orderBy: "name_ASC") you now write allUsers(orderBy: { name: asc }). You can also now order by multiple fields, e.g. allUsers(orderBy: [{ score: asc }, { name: asc }]). Each UserOrderByInput must have exactly one key, or else an error will be returned.

  • #5791 9de71a9fb Thanks @timleslie! - Changed the return type of allItems(...) from [User] to [User!], as this API can never have null items in the return array.

  • #5802 7bda87ea7 Thanks @timleslie! - Changed config.session to access a SessionStrategy object, rather than a () => SessionStrategy function. You will only need to change your configuration if you're using a customised session strategy.

  • #5828 4b11c5ea8 Thanks @timleslie! - Removed the keystone argument from the ExtendGraphqlSchema type. This will only impact you if you were directly constructing this function. Users of the graphQLSchemaExtension function will not be impacted.

  • #5787 bb4f4ac91 Thanks @timleslie! - Replaced req, session, createContext args to config.ui.pageMiddleware with a context arg.

Minor Changes

  • #5774 107eeb037 Thanks @jonowu! - Added sameSite option to session options for cookies

  • #5769 08478b8a7 Thanks @timleslie! - The GraphQL query _all<Items>Meta { count } generated for each list has been deprecated in favour of a new query <items>Count, which directy returns the count.

    A User list would have the following query added to the API:

    usersCount(where: UserWhereInput! = {}): Int

Patch Changes

18.0.0

Major Changes

  • #5746 19750d2dc Thanks @timleslie! - Update Node.js dependency to ^12.20 || >= 14.13.

  • #5677 e2232a553 Thanks @timleslie! - Consolidated the @keystone-next/admin-ui package into @keystone-next/keystone.

    If you were directly importing from @keystone-next/admin-ui you can now import the same items from @keystone-next/keystone/admin-ui. If you have @keystone-next/admin-ui in your package.json you should remove it.

Minor Changes

  • #5758 8da79e71a Thanks @timleslie! - Added a SKIP_PROMPTS environment variable to explicitly disable prompts in the CLI.

Patch Changes

17.2.0

Minor Changes

Patch Changes

17.1.1

Patch Changes

17.1.0

Minor Changes

Patch Changes

17.0.0

Major Changes

Minor Changes

Patch Changes

16.0.0

Major Changes

Minor Changes

  • #5451 9e060fe83 Thanks @JedWatson! - With the goal of making the Lists API (i.e context.lists.{List}) more intuitive to use, the resolveFields option has been deprecated in favor of two new methods:

    (1) You can specify a string of fields to return with the new query option, when you want to query for resolved field values (including querying relationships and virtual fields). This replaces the resolveFields: false use case.

    For example, to query a Post you would now write:

    const [post] = await context.lists.Post.findMany({
      where: { slug },
      query: `
        title
        content
        image {
          src
          width
          height
        }`,
    });

    (2) Alternatively, there is a new set of APIs on context.db.lists.{List} which will return the unresolved item data from the database (but with read hooks applied), which can then be referenced directly or returned from a custom mutation or query in the GraphQL API to be handled by the Field resolvers. This replaces the resolveFields: boolean use case.

    For example, to query for the raw data stored in the database, you would write:

    const [post] = await context.db.lists.Post.findMany({
      where: { slug },
    });
  • #5325 3d3fb860f Thanks @mitchellhamilton! - Updated to Prisma 2.20

  • #5378 6861ecb40 Thanks @renovate! - Updated Prisma to 2.21

  • #5396 be60812f2 Thanks @rohan-deshpande! - Added create-image-context, logic for parsing, storing and retrieving image data in keystone core.

Patch Changes

15.0.0

Major Changes

  • #5266 c28e765d1 Thanks @mitchellhamilton! - Replaced deploy, reset and generate commands with keystone-next prisma. You can use these commands as replacements for the old commands:

    • keystone-next deploy -> keystone-next prisma migrate deploy
    • keystone-next reset -> keystone-next prisma migrate reset
    • keystone-next generate -> keystone-next prisma migrate dev
  • #5266 c28e765d1 Thanks @mitchellhamilton! - Removed migrationAction argument to createSystem and require that the PrismaClient is passed to createSystem to be able to connect to the database.

  • #5266 c28e765d1 Thanks @mitchellhamilton! - Updated keystone-next build command to validate that the GraphQL and Prisma schemas are up to date.

  • #5287 95fefaf81 Thanks @mitchellhamilton! - Removed getDbSchemaName and getPrismaPath database adapter options. To change the database schema that Keystone uses, you can add ?schema=whatever to the database url.

  • #5266 c28e765d1 Thanks @mitchellhamilton! - Moved generated schema.prisma to the root of the project directory. Note that this also moves the location of migrations from .keystone/prisma/migrations to migrations at the root of the project.

  • #5266 c28e765d1 Thanks @mitchellhamilton! - Removed dotKeystonePath argument from createSystem

  • #5256 399e6db39 Thanks @timleslie! - Removed support for the knex and mongoose database adapters. We now only support prisma_postgresql and prisma_sqlite.

  • #5285 5cd94b2a3 Thanks @mitchellhamilton! - Removed dropDatabase method and config option

  • #5266 c28e765d1 Thanks @mitchellhamilton! - Moved generated GraphQL schema to schema.graphql to the root of the project. We recommend that you commit this file to your repo.

Minor Changes

Patch Changes

14.0.1

Patch Changes

14.0.0

Major Changes

Patch Changes

13.0.0

Major Changes

  • #5087 56e5fe10b Thanks @mitchellhamilton! - Updated createKeystone and createSystem to accept a migration mode rather than script

  • #5135 cdd889db1 Thanks @mitchellhamilton! - Updated keystone-next dev with the Prisma adapter so that it interactively prompts for creating and applying a migration

  • #5163 b37cbffc8 Thanks @mitchellhamilton! - Added db.useMigrations option to replace using keystone-next dev and keystone-next prototype depending on what kind of migration strategy you want to use. If you were previously using keystone-next dev, you should set db.useMigrations to true in your config and continue using keystone-next dev. If you were previously using keystone-next prototype, you should now use keystone-next dev.

  • #5155 215aed387 Thanks @mitchellhamilton! - Removed createOnly migration mode

  • #5163 b37cbffc8 Thanks @mitchellhamilton! - Replaced MigrationMode type with MigrationAction that createSystem and createKeystone now accept.

Minor Changes

  • #3946 8e9b04ecd Thanks @timleslie! - Added experimental support for Prisma + SQLite as a database adapter.

  • #5102 714bdadce Thanks @mitchellhamilton! - Added none-skip-client-generation migrationMode

  • #5148 e6b16d4e9 Thanks @mitchellhamilton! - Updated keystone-next deploy to use Prisma's programmatic APIs to apply migrations

  • #5155 215aed387 Thanks @mitchellhamilton! - Changed keystone-next generate so that it uses Prisma's programmatic APIs to generate migrations and it accepts the following options as command line arguments or as prompts:

    • --name to set the name of the migration
    • --accept-data-loss to allow resetting the database when it is out of sync with the migrations
    • --allow-empty to create an empty migration when there are no changes to the schema
  • #5084 40d4fff5d Thanks @timleslie! - Updated context.sudo() to provide access to all operations, including those excluded by { access: false } in the public schema.

  • #5152 00f980cad Thanks @mitchellhamilton! - Updated keystone-next reset to use Prisma's programmatic APIs to reset the database.

  • #4912 d31acf61b Thanks @timleslie! - Added a config.graphql.apolloConfig option to allow developers to configure the ApolloServer object provided by Keystone.

Patch Changes

12.0.0

Major Changes

  • #5082 a2c52848a Thanks @timleslie! - Updated createApolloServerMicro to take system arguments rather than a KeystoneConfig object.

Minor Changes

  • #5085 acc6e9772 Thanks @mitchellhamilton! - Added an option to pass in the prisma client to use instead of attempting to generate one and require()ing it to fix the experimental enableNextJsGraphqlApiEndpoint option not working on Vercel

  • #5085 acc6e9772 Thanks @mitchellhamilton! - Changed experimental enableNextJsGraphqlApiEndpoint option so that it doesn't use the API Route when running through Keystone's CLI

Patch Changes

11.0.2

Patch Changes

11.0.1

Patch Changes

11.0.0

Major Changes

  • 1c5a39972 #4923 Thanks @mitchellhamilton! - Fixed isAccessAllowed default so that if a session strategy is not used, access is always allowed to the Admin UI rather than never allowing access

  • 562cccbe1 #4935 Thanks @timleslie! - Removed itemId from FieldAccessArgs and no longer pass this value into field level imperative access control rules.

  • 24e0ef5b6 #4945 Thanks @timleslie! - Removed the context argument from KeystoneContext.graphql.raw and KeystoneContext.graphql.run.

  • d9c20ba66 #4832 Thanks @timleslie! - Replaced the function implementSession with createSessionContext.

  • 6469362a1 #4936 Thanks @timleslie! - Removed itemIds from FieldAccessArgs and no longer pass this value into field level imperative access control rules.

  • 0f86e99bb #4839 Thanks @timleslie! - Removed context.graphql.createContext from KeystoneContext.

Minor Changes

  • 2655c0b1b #4866 Thanks @timleslie! - Added a config.ui.isDisabled option to completely disable the Admin UI.

  • 0cd5acb82 #5017 Thanks @timleslie! - Added an isVerbose flag to createExpressServer to allow it to be run silently during tests.

  • f895a2671 #4860 Thanks @mitchellhamilton! - Updated the require hook used to compile code in development to use Next's Babel preset when no Babel config is present in the user's config to mirror how Keystone is built for production with Next.

  • 7ae67b857 #4874 Thanks @timleslie! - Exported the createExpressServer function to support running isolated unit tests against the GraphQL API.

  • 880fd5f92 #4951 Thanks @yannick1691! - Added domain option to session options for cookies.

Patch Changes

10.0.0

Major Changes

  • ee019cfc5 #4783 Thanks @mitchellhamilton! - Replaced views hashes with indexes so that if the path to a view is different between the build and the running instance, the Admin UI does not break

  • e29ae2749 #4818 Thanks @timleslie! - Added context.exitSudo() and context.withSession(session) methods. Removed context.createContext().

Minor Changes

  • 4035218df #4512 Thanks @renovate! - Upgraded dependency apollo-server-express to ^2.21.0. Apollo Server can now be installed with graphql@15 without causing peer dependency errors or warnings.

  • 8d0be8a89 #4815 Thanks @timleslie! - Added a .sudo() method to context objects, which is equivalent to the common operation context.createContext({ skipAccessControl: true }).

Patch Changes

9.3.1

Patch Changes

9.3.0

Minor Changes

  • fd0dff3fd #4669 Thanks @MurzNN! - Added the ability to set the server port number via config.server.port.

Patch Changes

9.2.0

Minor Changes

  • 94fbb45f1 #4728 Thanks @timleslie! - Added new CLI options to support migrations in the Prisma adapter: prototype, reset, generate, and deploy.

Patch Changes

9.1.0

Minor Changes

Patch Changes

9.0.2

Patch Changes

9.0.1

Patch Changes

9.0.0

Major Changes

  • 89f7d4599 #4586 Thanks @timleslie! - Removed adminMeta from KeystoneSystem. getAdminMetaSchema now takes a BaseKeystone argument keystone rather than adminMeta.

  • abc5440dc #4573 Thanks @timleslie! - Updated initConfig to return a copy of the config object, rather than modifying the object.

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.

Patch Changes

8.0.0

Major Changes

  • 075ef1628 #4547 Thanks @timleslie! - Removed allViews from KeystoneSystem type. createAdminMeta no longer returns allViews.

Patch Changes

7.0.0

Major Changes

Minor Changes

Patch Changes

6.0.0

Major Changes

  • dc58df5c8 #4493 Thanks @timleslie! - Renamed SerializedFieldMeta.views to SerializedFieldMeta.viewsIndex to makes it clear that this is the index, not the views object itself.

  • c89b43d07 #4453 Thanks @timleslie! - context.createContext() now inherits the argument values for sessionContext and skipAccessControl from context as defaults.

    This means, for example, that

    context.createContext({ skipAccessControl: true });

    will create a new context with the same sessionContext that the original context object had.

  • a5d7b264a #4473 Thanks @timleslie! - Added a resolveFields: false | string argument to the items API methods.

    This function controls the return type of the methods on the items API. If a string value is provided, it will be interpreted as a graphQL field specification fragment. The method will construct and run a graphQL operation and return the values specified by resolveFields. The default value for resolveFields is id.

    For example, to find the title and author name for all posts in our system we would run:

    const posts = await context.lists.Post.findMany({
      resolveFields: "id title author { id name }",
    });

    If resolveFields: false is provided, this indicates to the method that no field-resolving is desired. Instead, the method will return the result of the item-level resolver for the corresponding operation. These objects are the internal data representation of the items in the system which would normally be passed to the field resolvers.

    This flag is most useful in two specific scenarios. Firstly, if you need to inspect data which isn't generally available as a graphQL field, such as password hash values.

    Secondly, if you are writing a custom mutation which returns a list item type, such as Post. For example

    export const extendGraphqlSchema = graphQLSchemaExtension({
      typeDefs: `
        type Mutation {
          topPost(userId: ID): Post
        }
      `,
      resolvers: {
        Mutation: {
          topPost: (root, { userId }: { userId: string }, context) => {
            return context.lists.Post.findMany({
              where: { user: { id: userId } },
              first: 1,
              sortBy: ["stars_DESC"],
              resolveFields: false,
            });
          },
        },
      },
    });
  • b7a4b997b #4501 Thanks @timleslie! - Removed sessionImplementation from KeystoneSystem and instead pass it explicitly where needed.

  • ca34424d5 #4494 Thanks @timleslie! - Renamed KeystoneSystem.views to KeystoneSystem.allViews.

  • b21b62ed5 #4477 Thanks @timleslie! - Changed the type SessionContext to have parameters startSession and endSession as required. This type also takes a type parameter T which corresponds to the data type of the data argument to startSession.

  • 2da044a0c #4482 Thanks @timleslie! - Removed config from type KeystoneSystem. The config object is now explicitly passed around where needed to make it clear which code is consuming it. Type KeystoneAdminUIConfig.getAdditionalFiles now takes a config parameter.

  • 3f3c65ab2 #4458 Thanks @timleslie! - Removed createContextFromRequest and createSessionContext from KeystoneSystem and replaced them with sessionImplementation, which provides the same core functionality.

  • fe52e25e0 #4492 Thanks @timleslie! - Replaced the system argument on SessionStrategy.start, '.end, and.getwithcreateContext`.

  • c9c96cf71 #4452 Thanks @timleslie! - The items API (context.lists.Post.findOne(), etc) now use the context object they are bound to, rather than creating a new context object with { skipAccessControl: true } when executing the operation.

    If you were relying on this behaviour you should change your code from:

    context.lists.Post.findOne(...)

    to

    context.createContext({ skipAccessControl: true }).lists.Post.findOne(...)

Minor Changes

Patch Changes

5.0.0

Major Changes

  • 803626e88 #4440 Thanks @JedWatson! - Changed the config.db.onConnect argument to accept a KeystoneContext instance, created with { skipAccessControl: true }, rather than a BaseKeystone instance.

    Added database APIs { knex?, mongoose?, prisma? }" toKeystoneContext`.

Patch Changes

4.1.1

Patch Changes

4.1.0

Minor Changes

  • add3f67e3 #4316 Thanks @timleslie! - Added a config.server.cors option to allow configuration of the cors middleware. Updated the Apollo server middleware to not override cors options.

Patch Changes

4.0.0

Major Changes

  • c60b229ec #4299 Thanks @timleslie! - Renamed createKeystone to createSystem to make it consistent with the type names.

  • cc987d078 #4269 Thanks @timleslie! - Renamed keystone argument of KeystoneAdminUIConfig.getAdditionalFiles() and KeystoneAdminUIConfig.pageMiddleware() to system. Renamed keystone argument of SessionStrategy.start, SessionStrategy.end and SessionStrategy.get to system.

Minor Changes

  • c858a05fe #4246 Thanks @timleslie! - Added executeGraphQL and gqlNames to the context object. This provides the compatibility required to use @keystonejs/server-side-graphql-client in projects using the new interfaces.

Patch Changes

3.0.0

Major Changes

Minor Changes

Patch Changes

2.0.0

Major Changes

Patch Changes

1.0.0

Major Changes

Patch Changes