Skip to content

Releases: keystonejs/keystone

30 June 2022

30 Jun 03:41
14c59c1
Compare
Choose a tag to compare

30 June 2022

Feature release.

@keystone-6/core@2.1.0
@keystone-6/auth@4.0.0
@keystone-6/cloudinary@4.0.0
@keystone-6/fields-document@4.0.0
@keystone-6/session-store-redis@4.0.0

Adds MySQL Support

Keystone now supports MySQL by setting mysql in your db.provider see pull request #7538 for further information.

⚠️ There are some differences in how Postgres and MySQL operate so be sure to checkout our new choosing the right database guide.

Admin UI Improvements

  • ➕ Adds ui.description for fields to show a description below the label in the Admin UI - #7578
  • ➕ 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 #7657
  • Fixes the inconsistent spacing in the Admin UI on relationships fields using the cards display mode - #7616
  • Fixes the semantic-based browser input behaviour for inline create and edit forms on relationship fields when using the cards display mode - #7629
  • Fixes the layout and component block floating toolbars from being shown behind other elements - #7604
  • Moves the remove button in component block array fields from inside a menu on the drag handle to the right of the drag handle - #7626
  • Fixes the document editor from breaking when the underlying schema for a component has a new field added. Please note that new fields will still be missing for existing data when fetched from GraphQL - #7674
  • Changes segmented control to not show a clear button if isRequired is set - #7639 Thanks @u-ishii

Other Improvements ✨

  • ➕ Changes the cloudinaryImage GraphQL output type to be exported for developer usage, for example in virtual fields - #7607 Thanks @mmachatschek!
  • ➕ 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 - #7350 Thanks @chelkyl and @jlarmstrongiv!
  • ➕ Adds support for BigInt autoincrement id fields with idField: { kind: 'autoincrement', type: 'BigInt' } - #7188 Thanks @MurzNN!
  • Fixes for graphQLSchemaExtension, custom resolvers, if replacing default resolvers, were previously broken - #7644
  • ➕ Adds db.nativeType option to the text field to customise the database type - #7538
  • Fixes the generation of an invalid Prisma schema when {field}.isIndexed: true and {field}.db.map are set - #7666 Thanks @TonnyORG!

Acknowledgements 💙

Big shoutout to the following community members for their help in improving our documentation with their contributions:

Thanks to @mmachatschek (#7607), @ratson (#7627), @chelkyl (#7350) and @u-ishii (#7639) for making their first contributions to the project!

Enjoying Keystone?

Star this repo 🌟 ☝️ or connect with Keystone on Twitter and in Slack.

Verbose Changelog 📜

You can also view the verbose changelog or compare via GitHub since 2022-06-09

9 June 2022

09 Jun 00:37
51f3a22
Compare
Choose a tag to compare
🦋  @keystone-ui/button@7.0.0
🦋  @keystone-ui/core@5.0.0
🦋  @keystone-ui/fields@7.0.0
🦋  @keystone-ui/icons@6.0.0
🦋  @keystone-ui/loading@6.0.0
🦋  @keystone-ui/modals@6.0.0
🦋  @keystone-ui/notice@6.0.0
🦋  @keystone-ui/options@6.0.0
🦋  @keystone-ui/pill@7.0.0
🦋  @keystone-ui/popover@6.0.0
🦋  @keystone-ui/segmented-control@7.0.0
🦋  @keystone-ui/toast@6.0.0
🦋  @keystone-ui/tooltip@6.0.0
🦋  @keystone-6/auth@3.0.0
🦋  @keystone-6/cloudinary@3.0.0
🦋  @keystone-6/core@2.0.0
🦋  @keystone-6/document-renderer@1.1.0
🦋  @keystone-6/fields-document@3.0.0
🦋  @keystone-6/session-store-redis@3.0.0

New Features

Array Fields and Components Blocks

Warning: This new feature includes breaking changes that may affect you

Changes to the underlying document-editor component block interfaces, with the addition of array fields. The breaking changes are only for defining components, no database migration is needed.

The breaking changes for @keystone-6/fields-document/component-blocks are:

  • ⚠️ For the arguments of the component function, rename component to preview
  • ⚠️ For the arguments of the component function, rename props to schema
  • ⚠️ For your component .schema (previously .props), rename props.{innerFieldName} to props.fields.{innerFieldName}.
  • ⚠️ When rendering child field React components, change props.{innerFieldName} to props.{innerFieldName}.element.

For example, use props.fields.title instead of props.title.
For a nested example, use props.fields.someObject.fields.title instead of props.someObject.title.

See pull request #7428 for information on how to upgrade and solutions to common problems. If you have any other questions, please don't hesitate to open a GitHub discussion.

Images and Files

Warning: This new feature includes breaking changes that may affect you

The image and files configuration options have been removed from Keystone's configuration, and a new storage configuration object introduced.

  • ➕ Amazon S3 (and other compatible providers) are now supported when uploading images and files
  • ➕ New Guide coming - see #7563 will be merged soon but check it out if you are keen
  • 🚨 Images and files are now - DELETED BY DEFAULT from the underlying storage provider when replaced or deleted from the database
    • Note: A preserve flag has been added to the new storage configurations to default back to the previous behaviour

  • ⚠️ If you were previously using refs in your application, you need to migrate your database

See pull request #7070 for information on how to upgrade and solutions to common problems.
If you have any other questions, please don't hesitate to open a GitHub discussion.

Other Improvements

Major Dependency Upgrades

If you can't upgrade your dependencies for any reason and you think Keystone might be able to help, please open a GitHub discussion so we can try and help you.

React 18.1.0

We have updated React to version 18 (pull request #7410).

Redis 4

Our @keystone-6/session-store-redis package has been upgraded to use @redis/client@v1.1.0/redis@4.1.0 (pull request #7051).

Configuration

Added support for body-parser options when configuring GraphQL #7591

Admin UI

The following changes include a number of accessibility and quality of life improvements for users of the admin interface.

  • List descriptions now display in the Admin UI - #7537
  • Fixed the viewport sometimes shifting when opening the date picker in the create drawer - #7543
  • 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 - #7546
  • Fixed document editor preventing tabbing out of the editor - #7547
  • The label shown for a text field in the Admin UI is now associated with the input so the label can be read by screen readers - #7548
  • The document editor label is now associated with the editable element so the label can be read by screen readers - #7549
  • Fixed z-index issues occurring when pop-overs in document editor text-area or the toolbar overlapped other fields and buttons - #7556
  • Alert dialogs are now centered in the Admin UI - #7561
  • The reset changes button on the item view now presents a confirmation modal before resetting changes and it has been moved to the right of the bottom bar so it is next to the delete button. - #7562
  • Fixed splitting text with marks/inlines into multiple list items when turning a paragraph into a list and splitting a single list item with marks/inlines into multiple paragraphs when turning a list into paragraphs - #7565
  • Replaced create item drawer with a page when creating an item from the list view or dashboard - #7594
  • Fixed the Admin UI crashing when saving an item with a relationship field using the cards display mode when another item is added to the relationship (e.g. by another user or a hook) since the item was initially loaded - #7598

Could not find prisma-fmt binaries

A number of users have reported problems with the Prisma binaries not being installed properly by their package manager.

As part of pull request #7595 the Prisma binaries are now downloaded just before they're needed.
Note this should not happen in production, they should still be downloaded before as part of your deployment step.

Acknowledgements

Big shoutout to the following community members for their help in improving our documentation with their contributions:

Enjoying Keystone?

Star this repo 🌟 ☝️ or connect with Keystone on Twitter and in Slack.

Changelog

You can also view the verbose changelog in this pull request.

12 May 2022

12 May 06:47
0d3337a
Compare
Choose a tag to compare

Maintenance release.

"@keystone-6/core": "1.1.1"
"@keystone-6/fields-document": "2.0.1"

Core changes ⚙️

  • Fixed decimal validation.min not being respected and validation.max being used as the min if provided.

Admin UI – quality of life improvements ✨

  • The Admin UI now prompts users to confirm they want to navigate away when there are unsaved changes.
  • Fixed the JSON field not showing any formatting when the field mode is read-only
  • Updated the list page to show the reset to default button when any sorting, or other field value filters are provided
  • Updated the styling for the relationship select to be less confusing when the field mode is read-only
  • Improvements to the document editor toolbar:
    • the toolbar is now hidden when the field mode is read-only
    • fixed a z-index issue
  • Fixed read only view for segmented control display mode in the select field. When a segmented-control select field is in read mode, the values no longer appear editable.

Dependencies ⬆️

  • Upgrade react-day-picker to v8

New team members 🥳

We’re proud to announce that two new members have joined the team:

  • @Achi06 is a Software Developer who focuses on Front End. Achi has worked as an Angular Developer for HCL at Coles, an on several government projects including TAC and Queensland Health.
  • @borisno2 – the author behind the Keystone next auth plugin is now an official part of team Keystone. An awesome example of the power of OSS communities 💙

If you’re an AU or NZ based developer or designer looking to work on projects like Keystone, feel free to send your CV through to us at Thinkmill.

Community Contributors

  • Thanks @moselhy! - Fixed React key warning when showing GraphQL errors
  • Thanks @MurzNN! - Added sandbox configs for all examples, so now all our examples can be launched on the codesandbox.io service. Give it a try in our blog example 🚀

Enjoying Keystone?

Star this repo 🌟 ☝️ or connect to Keystone on Twitter and in Slack.

Changelog

You can also view the verbose changelog in this pull request.

⚙️ 25 March 2022

25 Mar 01:28
d4eadd6
Compare
Choose a tag to compare

Maintenance release.

"@keystone-6/auth": "2.0.0",
"@keystone-6/cloudinary": "2.0.0",
"@keystone-6/core": "1.1.0",
"@keystone-6/fields-document": "2.0.0",
"@keystone-6/session-store-redis": "2.0.0",

⚠️   This release contains a breaking change! Please read the instructions below.

Core ⚙️

Date Selection Issue

When selecting a date, the date picker sometimes changed to the previous day, this is now resolved.

The root of the problem as highlighted in #6115 is the inconsistency in how browsers handle new Date(value) where value is some string representation of a Date.

Year, month, and day to Date is now explicitly passed in for more deterministic behaviour.

Thanks @ChuckJonas and community members for reporting this issue.

Relationships in Component Blocks

⚠️   Breaking change! Please follow the guidance below.

We've moved the configuration for relationships in component blocks, if you have relationships in component blocks, you'll need to update your configuration.

This configuration has moved so that it's configured at the relationship prop rather than in the relationships key on the document field config.

The relationships key in the document field config now exclusively refers to inline relationships.

We have also added documentation for child fields and early validation for checking that relationships in the document field (both inline relationships and props in component blocks) refer to lists that actually exist.

Before:

import { config, list } from '@keystone-6/core';
import { document } from '@keystone-6/fields-document';
export default config({
  lists: {
    ListName: list({
      fields: {
        fieldName: document({
          relationships: {
            featuredAuthors: {
              kind: 'prop',
              listKey: 'Author',
              selection: 'id name posts { title }',
              many: true,
            },
          },
          /* ... */
        }),
        /* ... */
      },
    }),
    /* ... */
  },
  /* ... */
});
import { fields } from '@keystone-6/fields-document/component-blocks';
fields.relationship({ label: 'Authors', relationship: 'featuredAuthors' });

After:

import { fields } from '@keystone-6/fields-document/component-blocks';
fields.relationship({
  label: 'Authors',
  listKey: 'Author',
  selection: 'id name posts { title }',
  many: true,
});

Miscellaneous

  • Added support for extending the underlying Node.js http server, thanks @lachieh!
  • Fixed issues with float field filtering when the field is required with default value, thanks @gautamsi!
  • Bumped Next.js from 12.0.7 to 12.1.0, which fixed using require.resolve to get the paths to views not working with newer versions of Next.js
  • Updated Prisma to 3.9.2

Admin UI 👀

  • Fixes a bug where headings would appear in shortcut menu even when they were disabled
  • Fixes a bug where the shortcuts menu would clip behind the styles menu - it is now always above the styles menu
  • Fixed Popover component to toggle open and closed on click of the trigger, previously trigger click would only open the dialog. This is necessary because the Admin UI has limited usability on mobile phones, and when certain dialogs open, it is difficult to close by clicking outside. This adds the option of closing it by clicking the menu button again.
  • Fixed cards view in the relationship field not showing up for many relationships in the create view
  • Improved how stacking contexts are organised in the Admin UI
  • Minor a11y improvement to table browsing

Documentation ✏️

  • Fixed invalid field value for Selection in docs for Component Block Relationship Fields, thanks @nizhu!

Enjoying Keystone?

Star this repo 🌟 ☝️ or connect to Keystone on Twitter and in Slack.

Changelog

You can also view the verbose changelog in the related PR (#7219) for this release.

🔒 10th January 2022

10 Jan 03:08
e3c750c
Compare
Choose a tag to compare

This patch release is related to security advisory CVE-2022-0087.

"@keystone-6/auth": "1.0.2"

Security Advisory 🔒

This patch is relating to a security advisory that removes the capability for an attacker to exploit a reflected cross-site scripting vulnerability when using a previous version of the @keystone-6/auth package. The original security advisory is located here.

Impact

The vulnerability can impact users of the administration user interface when following an untrusted link to the signin or init page.
This is a targeted attack and may present itself in the form of phishing and or chained in conjunction with some other vulnerability.

Mitigation

Please upgrade to @keystone-6/auth >= 1.0.2 (this patch), where this vulnerability has been closed.
If you are using @keystone-next/auth, we strongly recommend you upgrade to @keystone-6.

Workarounds

If for some reason you cannot upgrade the dependencies in software, you could alternatively

  • disable the administration user interface, or
  • if using a reverse-proxy, strip query parameters when accessing the administration interface

References

https://owasp.org/www-community/attacks/xss/

Credits

Thanks to Shivansh Khari (@Shivansh-Khari) for discovering and reporting this vulnerability.

Enjoying Keystone?

Star this repo 🌟 ☝️ or connect to Keystone on Twitter and in Slack.

Changelog

You can also view the verbose changelog in the related PR (#7156) for this release.

⚙️ 22nd December 2021

22 Dec 05:30
b1d8f93
Compare
Choose a tag to compare

Patch release.

"@keystone-6/auth": "1.0.1",
"@keystone-6/core": "1.0.1",

Miscellaneous Fixes ⚙️

  • Page titles now reflect the page you are on: item view shows the item's label, list view shows the list name, other pages show Keystone
  • Refactoring of TypeScript type generation
  • Fixed the inferred type of a field resolveInput hook to support returning undefined
  • Explicitly disable caching for redirect responses in the Admin UI
  • Fixed error You must await server.start() before calling server.createHandler() when using the generateNextGraphqlAPI experimental option
  • Fixed setting db.enableLoggingto false erroring
  • Removed redundant fast-glob dependency
  • Updated Prisma monorepo to v3.6.0
  • Fixed Lists import in artifacts types, thanks @SerWonka!

Enjoying Keystone?

Star this repo 🌟 ☝️ or connect to Keystone on Twitter and in Slack.

Changelog

You can also view the verbose changelog in the related PR (#7044) for this release.

✨ 1st December 2021

01 Dec 02:43
b672137
Compare
Choose a tag to compare

This release marks the achievement of General Availability status for Keystone 6! 🚀

We've also included a range of improvements to Keystone's TypeScript DX since shipping last week's release candidate.

Keystone 6 ⚡️

With this major release, the project has moved to the @keystone-6 namespace on npm, and our version numbers have been reset.

We highly recommend you upgrade your existing Keystone Next projects to Keystone 6 with the packages below:

"@keystone-6/auth": "1.0.0",
"@keystone-6/cloudinary": "1.0.0",
"@keystone-6/document-renderer": "1.0.0",
"@keystone-6/fields-document": "1.0.0",
"@keystone-6/core": "1.0.0",
"@keystone-6/session-store-redis": "1.0.0",

Note: @keystone-next/keystone has been changed to @keystone-6/core

Among other internal naming changes, our CLI commands have switched from keystone-next to simply keystone, please ensure you update your startup scripts to suit!

Note: To learn more about this major release and what's in store for the road ahead, checkout our official general availability announcement and updated roadmap.

Type Enhancements ✨

We've shipped a significant update to our generated TypeScript types.

The types for your schema are stricter when your lists are contextually typed by the newly provided Lists types from .keystone/types.
This results in a smoother, type-safe auto-complete experience and stricter types for your access control, hooks, and any other code that uses a Keystone context.

For example, if you write all your lists in one object:

import { Lists } from '.keystone/types'

export const lists: Lists = {
  Blah: list({...})
}

If you're defining your lists separately, you can do this:

import { Lists } from '.keystone/types'

export const Blah: Lists.Blah = list({
  ...
})

For a more in-depth view of what TypeScript types have been changed, see below:

  • 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

Credits 💫

This release would not have been possible without the support and feedback of such an awesome developer community.

We're grateful for the ideas you bring, the help you give others, and the code contributions the you've made to get Keystone to where it is today.

Like this release? Give us a star on GitHub!

Changelog

You can view the verbose changelog in the related PR (#7018) for this release.

✨ 24th November 2021

24 Nov 00:23
e9221e7
Compare
Choose a tag to compare

The Release Candidate for Keystone 6 General Availability has arrived! Within you'll find numerous improvements across the project. ⭐️

After this release, we will be moving Keystone 6 to General Availability and promoting the project to the @keystone-6 namespace on npm.

We highly recommend you upgrade to this release:

"@keystone-next/auth": "37.0.0",
"@keystone-next/cloudinary": "12.0.0",
"@keystone-next/document-renderer": "5.0.0",
"@keystone-next/fields-document": "14.0.0",
"@keystone-next/keystone": "29.0.0",
"@keystone-next/session-store-redis": "9.0.0",

⚠️   This release contains breaking changes! Please backup your data before upgrading and read the instructions below.

Shorter Relationship Names 🤏

Warning: ⚠️ Breaking change! Please follow the guidance below to avoid losing data.

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.

There are two different ways you can update your schema:

  • Explicitly set the db.relationName on many-to-many relations, allowing your database to remain unchanged.

  • Rename your many-to-many relations and tables using a migration, changing your database.

Set db.relationName on many to many relations

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 yarn dev, Keystone will prompt you to update your schema.

Warning: ⚠️ Warning: DO NOT APPLY THE AUTOMATICALLY GENERATED MIGRATION!
You will lose your data. Only apply the migration if you want to DROP your data.

If using useMigrations: true, Keystone will follow the typical migration flow and offer to apply an automatically generated migration.

If using useMigrations: false, Keystone will follow the typical flow and offer to automatically migrate your schema.

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");

Query Engine Switch 🚂

Keystone now uses Prisma's Node-API Query Engine instead of the Binary Query Engine. This should improve the performance of operations using Prisma.

From our initial testing, performance has increased significantly when getting large amounts of data and is marginally better for smaller amounts.

See the Prisma docs for more details.

Node Engines 💽

Keystone officially supports running on LTS versions of Node.js - this is currently version 14 and 16. We've updated our engine values throughout the project to reflect this.

Note: We recommend you run Node.js ^14.15 or ^16.13 for the best Keystone experience.

Miscellaneous Fixes ⚙️

  • Fixed the init/sign in page showing for a short amount of time after submitting on the init/sign in page and seeing a loading spinner.

  • Fixed clear button not removing inline relationships when used in the document field.

  • Relationship field now respects ui.displayMode: 'cards' in the create view.

  • The Set as Authenticated Item/Add Authenticated Item button is now hidden if the relationship field already has the authenticated item.

  • Fixed ui.isAccessAllowed not being respected in the admin meta query when no session strategy was defined.

  • The item page in the Admin UI no longer crashes when failing to fetch an item.

  • The admin meta query now bypasses ui.isAccessAllowed for sudo contexts.

  • Fixed doing multiple writes at the same time on SQLite causing an timeout immediately.

Credits 💫

Like this release? Give us a star on GitHub!

Changelog

You can view the verbose changelog in the related PR (#6943) for this release.

✨ 15th November 2021

17 Nov 00:27
aecbe67
Compare
Choose a tag to compare

Expanded unique filters, customisable table and column names support and a new example featuring Nexus as we continue to finalise our GA release. 🪢

"@keystone-next/auth": "36.0.0",
"@keystone-next/cloudinary": "11.0.0",
"@keystone-next/fields-document": "13.0.0",
"@keystone-next/keystone": "28.0.0",
"@keystone-next/session-store-redis": "8.0.0",

Like this release? Give us a star on GitHub!

Expanded Unique Filters 🔎

select, timestamp, float and decimal fields with isIndexed: 'unique' now have unique filters via ListWhereUniqueInput which text, integer and the id field already support.

For example, if you added isIndexed: 'unique' to a select field in a theoretical Settings list, you can now run the following query:

query {
  setting ( where: { provider: "github" } ) {
    id
    token
  }
}

This is instead of running a settings query where you would have received a list back, and have had to check for results and get the first element:

query {
  settings ( where: { provider: { equals: "github" } } ) {
    id
    token
  }
}

Customisable Table and Column Names 📇

You may now use different table and column names to those automatically chosen by Keystone for your list and field keys. This is powered by Prisma's @map and @@map attributes. You can read more about this concept in Prisma's documentation.

This is useful if you do not want to modify your existing database (such as a read-only database) and use it with Keystone.

For example if you wanted to refer to a table named stories but you refer to it in Keystone as Posts provide config.db.map to a list or field key such as:

Post: list({
  db: {
    map: 'stories',
  },
  fields: {
    ...
  }
})

Nexus Example 🪢

We've got a new example using Nexus, a declarative, code-first and strongly typed GraphQL schema construction for TypeScript & JavaScript.

Using Nexus you can extend the GraphQL API provided by Keystone with custom queries and mutations.

In the example below we expose a mutation called nexusPosts which pulls out items from our Posts list that have been published within the past 7 days (by default), with an optional author filter.

export const PostQuery = extendType({
  type: "Query",
  definition(t) {
    t.field("nexusPosts", {
      type: nonNull(list("NexusPost")),
      args: {
        authorId: stringArg(),
        days: nonNull(intArg({ default: 7 })),
      },
      async resolve(root, { authorId, days }, context) {
        const cutoff = new Date(
          new Date().setUTCDate(new Date().getUTCDate() - days)
        ).toISOString();

        return await context.prisma.post.findMany({
          where: {
            ...(authorId ? { author: { id: authorId } } : null),
            publishDate: { gt: cutoff },
          },
        });
      },
    });
  },
});

Check out the example in Keystone's examples directory.

Miscellaneous Fixes ⚙️

  • The format of the date shown in the DatePicker now uses the user's locale.
  • When the sessionData option is invalid, the error will now be thrown on startup instead of silently ignored.

Changelog

You can also the verbose changelog in the related PR (#6914) for this release.

⚙️ 10th November 2021

17 Nov 00:23
1549a7f
Compare
Choose a tag to compare

Patch release.

"@keystone-next/keystone": "27.0.2",

Miscellaneous Fixes ⚙️

  • Fixed importing packages that provide Node ESM
  • Local images and files are no longer restricted behind ui.isAccessAllowed
  • Updated Prisma monorepo to v3.4.0

Enjoying Keystone?

Star this repo 🌟 ☝️ or connect to Keystone on Twitter and in Slack.

Changelog

You can also view the verbose changelog in the related PR (#6892) for this release.