diff --git a/.changeset/add-number-id.md b/.changeset/add-number-id.md deleted file mode 100644 index 83346d86c5b..00000000000 --- a/.changeset/add-number-id.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystone-6/core': patch ---- - -Use `db.idField` of `{ kind: 'number', kind: 'Int' }` internally for singletons diff --git a/.changeset/better-relationship-errors.md b/.changeset/better-relationship-errors.md deleted file mode 100644 index 85ed3f2010d..00000000000 --- a/.changeset/better-relationship-errors.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystone-6/core': patch ---- - -Fix static relationship resolution errors to conform to nominal error structure diff --git a/.changeset/boolean-not-false-2.md b/.changeset/boolean-not-false-2.md deleted file mode 100644 index 84e380028f4..00000000000 --- a/.changeset/boolean-not-false-2.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystone-6/core': patch ---- - -Fix `config.server.cors` type preventing value of `false` diff --git a/.changeset/boolean-not-false.md b/.changeset/boolean-not-false.md deleted file mode 100644 index 97d359a18cc..00000000000 --- a/.changeset/boolean-not-false.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystone-6/core': patch ---- - -Fix `defaultIsFilterable` and `defaultIsOrderable` types preventing value of `true` diff --git a/.changeset/break-list-types.md b/.changeset/break-list-types.md new file mode 100644 index 00000000000..0ea9f2e8416 --- /dev/null +++ b/.changeset/break-list-types.md @@ -0,0 +1,5 @@ +--- +'@keystone-6/core': major +--- + +Removes unused type parameters from types `ListConfig` and `ListAdminUIConfig` diff --git a/.changeset/deprecate-validate-hooks-f.md b/.changeset/deprecate-validate-hooks-f.md deleted file mode 100644 index 79a655cd759..00000000000 --- a/.changeset/deprecate-validate-hooks-f.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystone-6/core': minor ---- - -Adds `{field}.hooks.validate.[create|update|delete]` hooks, deprecates `validateInput` and `validateDelete` (throws if incompatible) diff --git a/.changeset/deprecate-validate-hooks.md b/.changeset/deprecate-validate-hooks.md deleted file mode 100644 index b3f9eb4c856..00000000000 --- a/.changeset/deprecate-validate-hooks.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystone-6/core': minor ---- - -Adds `{list}.hooks.validate.[create|update|delete]` hooks, deprecates `validateInput` and `validateDelete` diff --git a/.changeset/error-if-wrong-type.md b/.changeset/error-if-wrong-type.md deleted file mode 100644 index 9b2531d8988..00000000000 --- a/.changeset/error-if-wrong-type.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystone-6/auth': patch ---- - -Fix `createInitial*` and `send*MagicAuthLink` to throw if the expected type from `sessionStrategy.start` is not a string diff --git a/.changeset/fix-create-express-app.md b/.changeset/fix-create-express-app.md deleted file mode 100644 index deb215b6dc7..00000000000 --- a/.changeset/fix-create-express-app.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystone-6/core': patch ---- - -Fixes `createExpressApp` to use `context.graphql.schema`, not the GraphQLSchema argument diff --git a/.changeset/fix-list-group-types.md b/.changeset/fix-list-group-types.md new file mode 100644 index 00000000000..a7498fb76cc --- /dev/null +++ b/.changeset/fix-list-group-types.md @@ -0,0 +1,5 @@ +--- +'@keystone-6/core': major +--- + +Remove the deprecated type parameters from the `list` and `group` functions diff --git a/.changeset/http-async.md b/.changeset/http-async.md deleted file mode 100644 index 1160979d9e3..00000000000 --- a/.changeset/http-async.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystone-6/core': minor ---- - -Add `async` to `extendHttpServer`, to support `await` on startup diff --git a/.changeset/less-extend-http-param.md b/.changeset/less-extend-http-param.md new file mode 100644 index 00000000000..aee4025bfe8 --- /dev/null +++ b/.changeset/less-extend-http-param.md @@ -0,0 +1,5 @@ +--- +'@keystone-6/core': major +--- + +Removes `graphqlSchema` parameter from `extendHttpServer`, use `context.graphql.schema` instead diff --git a/.changeset/less-extend-http-server.md b/.changeset/less-extend-http-server.md deleted file mode 100644 index 4a7f2001c60..00000000000 --- a/.changeset/less-extend-http-server.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystone-6/core': patch ---- - -Deprecates `extendHttpServer`'s `graphqlSchema` argument, use `context.graphql.schema` instead diff --git a/.changeset/less-extend-type.md b/.changeset/less-extend-type.md deleted file mode 100644 index 3e07049f562..00000000000 --- a/.changeset/less-extend-type.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystone-6/core': patch ---- - -Deprecates `ExtendGraphQLSchema` type, use type `(schema: GraphQLSchema) => GraphQLSchema` instead diff --git a/.changeset/less-plimit.md b/.changeset/less-plimit.md deleted file mode 100644 index 5b5732117d1..00000000000 --- a/.changeset/less-plimit.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystone-6/core': patch ---- - -Fix global locking by dropping global `p-limit` on `context.query`/`context.db` diff --git a/.changeset/move-extend-graphql.md b/.changeset/move-extend-graphql.md new file mode 100644 index 00000000000..43893693331 --- /dev/null +++ b/.changeset/move-extend-graphql.md @@ -0,0 +1,5 @@ +--- +'@keystone-6/core': major +--- + +Moves `config.extendGraphqlSchema` to `config.graphql.extendGraphqlSchema`, similar to `db.extendPrismaSchema` diff --git a/.changeset/no-additional-config.md b/.changeset/no-additional-config.md new file mode 100644 index 00000000000..ee85b7eba32 --- /dev/null +++ b/.changeset/no-additional-config.md @@ -0,0 +1,5 @@ +--- +'@keystone-6/core': major +--- + +Remove `KeystoneConfig` parameter from getAdditionalFiles function type diff --git a/.changeset/no-exit-sudo.md b/.changeset/no-exit-sudo.md new file mode 100644 index 00000000000..00b140ce7ee --- /dev/null +++ b/.changeset/no-exit-sudo.md @@ -0,0 +1,5 @@ +--- +'@keystone-6/core': major +--- + +Remove the deprecated `context.exitSudo` from `KeystoneContext` diff --git a/.changeset/no-experimental.md b/.changeset/no-experimental.md new file mode 100644 index 00000000000..786b94b5c01 --- /dev/null +++ b/.changeset/no-experimental.md @@ -0,0 +1,5 @@ +--- +'@keystone-6/core': major +--- + +Remove `context.experimental.initialisedLists`, use `context.__internal.lists` (may break in patch) diff --git a/.changeset/no-extend-type.md b/.changeset/no-extend-type.md new file mode 100644 index 00000000000..0a9476aca1e --- /dev/null +++ b/.changeset/no-extend-type.md @@ -0,0 +1,5 @@ +--- +'@keystone-6/core': major +--- + +Remove `ExtendGraphqlSchema` type alias, use `(schema: GraphQLSchema) => GraphQLSchema` instead (with `import type { GraphQLSchema } from 'graphql'`). diff --git a/.changeset/no-healthcheck.md b/.changeset/no-healthcheck.md new file mode 100644 index 00000000000..c6c3dfd41a7 --- /dev/null +++ b/.changeset/no-healthcheck.md @@ -0,0 +1,5 @@ +--- +'@keystone-6/core': major +--- + +Remove the deprecated (#8721) `config.server.healthCheck`, use `extendExpressApp` instead diff --git a/.changeset/no-list-schema-type.md b/.changeset/no-list-schema-type.md new file mode 100644 index 00000000000..9e404b0efb1 --- /dev/null +++ b/.changeset/no-list-schema-type.md @@ -0,0 +1,5 @@ +--- +'@keystone-6/core': major +--- + +Removes `ListSchemaConfig` type, use `KeystoneConfig['lists']` instead diff --git a/.changeset/no-prisma-datasource.md b/.changeset/no-prisma-datasource.md new file mode 100644 index 00000000000..b4346690081 --- /dev/null +++ b/.changeset/no-prisma-datasource.md @@ -0,0 +1,5 @@ +--- +'@keystone-6/core': major +--- + +Remove `db.additionalPrismaDatasourceProperties`, use `extendPrismaSchema` if needed diff --git a/.changeset/no-prisma-preview.md b/.changeset/no-prisma-preview.md new file mode 100644 index 00000000000..6c78c8abb2c --- /dev/null +++ b/.changeset/no-prisma-preview.md @@ -0,0 +1,5 @@ +--- +'@keystone-6/core': major +--- + +Remove `db.prismaPreviewFeatures`, use `extendPrismaSchema` if needed diff --git a/.changeset/no-session-any.md b/.changeset/no-session-any.md new file mode 100644 index 00000000000..cb72785bb21 --- /dev/null +++ b/.changeset/no-session-any.md @@ -0,0 +1,5 @@ +--- +'@keystone-6/core': major +--- + +Remove `any` type parameter from `SessionStore`/`SessionStoreFunction` types diff --git a/.changeset/same-field-order.md b/.changeset/same-field-order.md deleted file mode 100644 index 0fa991a13ae..00000000000 --- a/.changeset/same-field-order.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystone-6/core': patch ---- - -Fix `image` field type to use consistent sub-field ordering diff --git a/.changeset/text-null-default.md b/.changeset/text-null-default.md deleted file mode 100644 index 3405e022f17..00000000000 --- a/.changeset/text-null-default.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystone-6/core': patch ---- - -Fixes the `text` field type to accept a `defaultValue` of `null` diff --git a/.github/workflows/tests_ci.yml b/.github/workflows/tests_ci.yml index b8073dcca9e..61b92db3840 100644 --- a/.github/workflows/tests_ci.yml +++ b/.github/workflows/tests_ci.yml @@ -198,7 +198,7 @@ jobs: run: cd examples/testing; pnpm test examples_next_app_build: - name: Ensure Nest in App directory builds + name: Ensure Next in App directory builds runs-on: ubuntu-latest steps: - uses: actions/checkout@main diff --git a/docs/pages/blog/embedded-mode-with-sqlite-nextjs.md b/docs/pages/blog/embedded-mode-with-sqlite-nextjs.md index d3ad2c6a266..f334151bca7 100644 --- a/docs/pages/blog/embedded-mode-with-sqlite-nextjs.md +++ b/docs/pages/blog/embedded-mode-with-sqlite-nextjs.md @@ -102,10 +102,6 @@ Add the `.keystone` directory to your `.gitignore` file. The contents of `.keyst To create and edit blog records in Keystone's Admin UI, add a `keystone.ts` [configuration file](/docs/config/config) to your project root with a simple `Post` [list](/docs/config/lists) containing fields for a Title, Slug, and some Content. -{% hint kind="warn" %} -**Note:** We're enabling experimental features to generate the APIs that make embedded mode work. These may change in future versions. -{% /hint %} - ```tsx // keystone.ts @@ -125,9 +121,6 @@ const Post: Lists.Post = list({ export default config({ db: { provider: 'sqlite', url: 'file:./app.db' }, - experimental: { - generateNextGraphqlAPI: true, - }, lists: { Post }, }); ``` diff --git a/docs/pages/docs/config/config.md b/docs/pages/docs/config/config.md index 1e8bb9a732e..d21ca962754 100644 --- a/docs/pages/docs/config/config.md +++ b/docs/pages/docs/config/config.md @@ -23,7 +23,6 @@ export default config({ graphql: { /* ... */ }, extendGraphqlSchema: { /* ... */ }, storage: { /* ... */ }, - experimental: { /* ... */ }, }); ``` @@ -43,12 +42,10 @@ export default config({ /* ... */ }); ## lists The `lists` config option is where you define the data model, or schema, of the Keystone system. -It has a TypeScript type of `ListSchemaConfig`. This is where you define and configure the `lists` and their `fields` of the data model. See the [Lists API](./lists) docs for details on how to use this function. ```typescript -import type { ListSchemaConfig } from '@keystone-6/core/types'; import { config } from '@keystone-6/core'; import { TypeInfo } from ".keystone/types"; @@ -60,12 +57,7 @@ export default config({ ## db -``` -import type { DatabaseConfig } from '@keystone-6/core/types'; -``` - The `db` config option configures the database used to store data in your Keystone system. -It has a TypeScript type of `DatabaseConfig`. Keystone supports the database types **PostgreSQL**, **MySQL** and **SQLite**. These database types are powered by their corresponding Prisma database providers; `postgresql`, `mysql` and `sqlite`. @@ -76,8 +68,6 @@ These database types are powered by their corresponding Prisma database provider - `idField` (default: `{ kind: "cuid" }`): The kind of id field to use, it can be one of: `cuid`, `uuid` or `autoincrement`. This can also be customised at the list level `db.idField`. If you are using `autoincrement`, you can also specify `type: 'BigInt'` on PostgreSQL and MySQL to use BigInts. -- `prismaPreviewFeatures` (default: `[]`): Enable [Prisma preview features](https://www.prisma.io/docs/concepts/components/preview-features) by providing an array of strings. -- `additionalPrismaDatasourceProperties` (default: `{}`): Set additional datasource properties like `relationMode = "prisma"` (required for e.g. PlanetScale) by providing an object with key-value pairs. - `shadowDatabaseUrl` (default: `undefined`): Enable [shadow databases](https://www.prisma.io/docs/concepts/components/prisma-migrate/shadow-database#cloud-hosted-shadow-databases-must-be-created-manually) for some cloud providers. ### postgresql @@ -142,12 +132,7 @@ The `sqlite` provider is not intended to be used in production systems, and has ## ui -```ts -import type { AdminUIConfig } from '@keystone-6/core/types'; -``` - The `ui` config option configures the Admin UI which is provided by Keystone. -It has a TypeScript type of `AdminUIConfig`. This config option is for top level configuration of the Admin UI. Fine grained configuration of how lists and fields behave in the Admin UI is handled in the `lists` definition (see the [Lists API](./lists) for more details). @@ -203,10 +188,6 @@ export default config({ ## server -``` -import type { ServerConfig } from '@keystone-6/core/types'; -``` - The `dev` and `start` commands from the Keystone [command line](../guides/cli) will start an Express web-server for you. This server is configured via the `server` configuration option. @@ -324,12 +305,7 @@ _Note_: when using `keystone dev`, `extendHttpServer` is only called once on sta ## session -``` -import type { SessionStrategy } from '@keystone-6/core/types'; -``` - The `session` config option allows you to configure session management of your Keystone system. -It has a TypeScript type of `SessionStrategy`. In general you will use `SessionStrategy` objects from the `@keystone-6/core/session` package, rather than writing this yourself. @@ -347,12 +323,7 @@ See the [Session API](./session) for more details on how to configure session ma ## graphql -```ts -import type { GraphQLConfig } from '@keystone-6/core/types'; -``` - The `graphql` config option allows you to configure certain aspects of your GraphQL API. -It has a TypeScript type of `GraphQLConfig`. Options: @@ -383,6 +354,7 @@ export default config({ ## extendGraphqlSchema The `extendGraphqlSchema` config option allows you to extend the GraphQL API which is generated by Keystone based on your schema definition. +It has a TypeScript type of `(schema: import("graphql").GraphQLSchema) => import("graphql").GraphQLSchema`. `extendGraphqlSchema` expects a function that takes the GraphQL Schema generated by Keystone and returns a valid GraphQL Schema @@ -403,10 +375,6 @@ See the [schema extension guide](../guides/schema-extension) for more details an ## storage (images and files) -```ts -import type { StorageConfig } from '@keystone-6/core/types' -``` - The `storage` config option provides configuration which is used by the [`file`](../fields/file) field type or the [`image`](../fields/image) field type. You provide an object whose property is a `StorageConfig` object, fields then reference this `storage` by the key. Each storage is configured separately using the options below. diff --git a/examples/extend-graphql-schema-graphql-tools/keystone.ts b/examples/extend-graphql-schema-graphql-tools/keystone.ts index bf93b6dfe61..3051fe226d2 100644 --- a/examples/extend-graphql-schema-graphql-tools/keystone.ts +++ b/examples/extend-graphql-schema-graphql-tools/keystone.ts @@ -10,6 +10,8 @@ export default config({ // WARNING: this is only needed for our monorepo examples, dont do this ...fixPrismaPath, }, + graphql: { + extendGraphqlSchema + }, lists, - extendGraphqlSchema, -}) +}) \ No newline at end of file diff --git a/examples/extend-graphql-schema-graphql-ts/keystone.ts b/examples/extend-graphql-schema-graphql-ts/keystone.ts index bf93b6dfe61..876de997ec1 100644 --- a/examples/extend-graphql-schema-graphql-ts/keystone.ts +++ b/examples/extend-graphql-schema-graphql-ts/keystone.ts @@ -10,6 +10,8 @@ export default config({ // WARNING: this is only needed for our monorepo examples, dont do this ...fixPrismaPath, }, + graphql: { + extendGraphqlSchema + }, lists, - extendGraphqlSchema, }) diff --git a/examples/extend-graphql-schema-nexus/keystone.ts b/examples/extend-graphql-schema-nexus/keystone.ts index 30eb684df35..063c3ee5720 100644 --- a/examples/extend-graphql-schema-nexus/keystone.ts +++ b/examples/extend-graphql-schema-nexus/keystone.ts @@ -10,9 +10,10 @@ export default config({ // WARNING: this is only needed for our monorepo examples, dont do this ...fixPrismaPath, }, + graphql: { + extendGraphqlSchema + }, lists, - extendGraphqlSchema, - // we use a custom types path for easy integration with nexus types: { path: 'keystone-types.ts', diff --git a/examples/extend-graphql-subscriptions/keystone.ts b/examples/extend-graphql-subscriptions/keystone.ts index 7f3ed1dd57c..d8b83b33745 100644 --- a/examples/extend-graphql-subscriptions/keystone.ts +++ b/examples/extend-graphql-subscriptions/keystone.ts @@ -11,9 +11,11 @@ export default config({ // WARNING: this is only needed for our monorepo examples, dont do this ...fixPrismaPath, }, + graphql: { + extendGraphqlSchema + }, lists, server: { extendHttpServer, }, - extendGraphqlSchema, }) diff --git a/examples/extend-graphql-subscriptions/websocket.ts b/examples/extend-graphql-subscriptions/websocket.ts index 262fad75f3c..3e1d446ee33 100644 --- a/examples/extend-graphql-subscriptions/websocket.ts +++ b/examples/extend-graphql-subscriptions/websocket.ts @@ -4,7 +4,6 @@ import { WebSocketServer } from 'ws' import { PubSub } from 'graphql-subscriptions' import { parse } from 'graphql' -import { type KeystoneGraphQLAPI } from '@keystone-6/core/types' import { type Context } from '.keystone/types' // Setup pubsub as a Global variable in dev so it survives Hot Reloads. @@ -17,11 +16,10 @@ declare global { export const pubSub = global.graphqlSubscriptionPubSub || new PubSub() globalThis.graphqlSubscriptionPubSub = pubSub -export const extendHttpServer = ( +export function extendHttpServer ( httpServer: http.Server, commonContext: Context, - graphqlSchema: KeystoneGraphQLAPI['schema'] -): void => { +) { // Setup WebSocket server using 'ws' const wss = new WebSocketServer({ server: httpServer, @@ -31,13 +29,13 @@ export const extendHttpServer = ( // Setup the WebSocket to handle GraphQL subscriptions using 'graphql-ws' wsUseServer( { - schema: graphqlSchema, + schema: commonContext.graphql.schema, // run these onSubscribe functions as needed or remove them if you don't need them onSubscribe: async (ctx: any, msg) => { const context = await commonContext.withRequest(ctx.extra.request) // Return the execution args for this subscription passing through the Keystone Context return { - schema: graphqlSchema, + schema: commonContext.graphql.schema, operationName: msg.payload.operationName, document: parse(msg.payload.query), variableValues: msg.payload.variables, diff --git a/examples/script/script.ts b/examples/script/script.ts index 640c92eaa0d..c862803a03e 100644 --- a/examples/script/script.ts +++ b/examples/script/script.ts @@ -5,7 +5,7 @@ import config from './keystone' import * as PrismaModule from '.myprisma/client' // do this instead -// import * as PrismaModule from '@prisma/client'; +// import * as PrismaModule from '@prisma/client' async function main () { const context = getContext(config, PrismaModule) diff --git a/packages/auth/src/index.ts b/packages/auth/src/index.ts index 08b8ff8d3d9..6ce97015ca9 100644 --- a/packages/auth/src/index.ts +++ b/packages/auth/src/index.ts @@ -279,11 +279,18 @@ export function createAuth ({ if (!config.session) throw new TypeError('Missing .session configuration') - const { extendGraphqlSchema = defaultExtendGraphqlSchema } = config + const { graphql } = config + const { extendGraphqlSchema = defaultExtendGraphqlSchema } = graphql ?? {} const authListConfig = config.lists[listKey] return { ...config, + graphql: { + ...config.graphql, + extendGraphqlSchema: (schema) => { + return extendGraphqlSchema(authExtendGraphqlSchema(schema)) + }, + }, ui, session: authSessionStrategy(config.session), lists: { @@ -296,9 +303,6 @@ export function createAuth ({ }, }, }, - extendGraphqlSchema: schema => { - return extendGraphqlSchema(authExtendGraphqlSchema(schema)) - }, } } diff --git a/packages/core/src/admin-ui/system/generateAdminUI.ts b/packages/core/src/admin-ui/system/generateAdminUI.ts index a8fe859f53d..5ecaef7bd37 100644 --- a/packages/core/src/admin-ui/system/generateAdminUI.ts +++ b/packages/core/src/admin-ui/system/generateAdminUI.ts @@ -91,7 +91,7 @@ export async function generateAdminUI ( } // Write out the files configured by the user - const userFiles = config.ui?.getAdditionalFiles?.map(x => x(config)) ?? [] + const userFiles = config.ui?.getAdditionalFiles?.map(x => x()) ?? [] const userFilesToWrite = (await Promise.all(userFiles)).flat() const savedFiles = await Promise.all( userFilesToWrite.map(file => writeAdminFile(file, projectAdminPath)) diff --git a/packages/core/src/artifacts.ts b/packages/core/src/artifacts.ts index b7684ef2d84..b3d5af43a05 100644 --- a/packages/core/src/artifacts.ts +++ b/packages/core/src/artifacts.ts @@ -71,8 +71,7 @@ export function getBuiltKeystoneConfigurationPath (cwd: string) { } export function getBuiltKeystoneConfiguration (cwd: string) { - const configPath = getBuiltKeystoneConfigurationPath(cwd) - return initConfig(require(configPath).default) + return initConfig(require(getBuiltKeystoneConfigurationPath(cwd)).default) } function posixify (s: string) { diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index ff962f73a70..19f535dc7e7 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,3 +1,3 @@ export { list, config, group } from './schema' -export type { ListSchemaConfig, ListConfig, ExtendGraphqlSchema, BaseFields } from './types' +export type { ListConfig, BaseFields } from './types' export { graphql } from './types/schema' diff --git a/packages/core/src/lib/context/createContext.ts b/packages/core/src/lib/context/createContext.ts index bb7197d728c..986b70b8327 100644 --- a/packages/core/src/lib/context/createContext.ts +++ b/packages/core/src/lib/context/createContext.ts @@ -107,9 +107,6 @@ export function createContext ({ sudo: () => construct({ session, sudo: true, req, res }), - // TODO: deprecated, remove in breaking change - exitSudo: () => construct({ session, sudo: false, req, res }), - req, res, sessionStrategy: config.session, @@ -123,17 +120,8 @@ export function createContext ({ images, files, - // TODO: deprecated, remove in breaking change - gqlNames: (listKey: string) => lists[listKey].graphql.names, - - // TODO: deprecated, remove in breaking change - ...(config.experimental?.contextInitialisedLists - ? { - experimental: { initialisedLists: lists }, - } - : {}), - __internal: { + lists, prisma: { ...prismaTypes } diff --git a/packages/core/src/lib/core/prisma-schema-printer.ts b/packages/core/src/lib/core/prisma-schema-printer.ts index 8dd48a08bc8..10f95e28368 100644 --- a/packages/core/src/lib/core/prisma-schema-printer.ts +++ b/packages/core/src/lib/core/prisma-schema-printer.ts @@ -184,8 +184,6 @@ export function printPrismaSchema ( const { prismaClientPath, provider, - prismaPreviewFeatures, - additionalPrismaDatasourceProperties, extendPrismaSchema: extendPrismaCompleteSchema } = config.db @@ -197,19 +195,11 @@ export function printPrismaSchema ( ` url = env("DATABASE_URL")`, ` shadowDatabaseUrl = env("SHADOW_DATABASE_URL")`, ` provider = "${provider}"`, - ...function* () { - for (const [key, value] of Object.entries(additionalPrismaDatasourceProperties ?? {})) { - yield ` ${key} = "${value}"` - } - }(), `}`, ``, `generator client {`, ` provider = "prisma-client-js"`, ...(prismaClientPath === '@prisma/client' ? [] : [` output = "${prismaClientPath}"`]), - ...(prismaPreviewFeatures?.length - ? [` previewFeatures = ["${prismaPreviewFeatures.join('","')}"]`] - : []), '}', ] diff --git a/packages/core/src/lib/createExpressServer.ts b/packages/core/src/lib/createExpressServer.ts index e318dddb9a3..a873f332f47 100644 --- a/packages/core/src/lib/createExpressServer.ts +++ b/packages/core/src/lib/createExpressServer.ts @@ -48,7 +48,6 @@ function formatError (graphqlConfig: GraphQLConfig | undefined) { export async function createExpressServer ( config: Pick, - _: any, // TODO: uses context.graphql.schema now, remove in breaking change context: KeystoneContext ): Promise<{ expressServer: express.Express @@ -68,23 +67,8 @@ export async function createExpressServer ( expressServer.use(cors(corsConfig)) } - /** @deprecated, TODO: remove in breaking change */ - if (config.server?.healthCheck) { - const healthCheck = config.server.healthCheck === true ? {} : config.server.healthCheck - - expressServer.use(healthCheck.path ?? '/_healthcheck', (req, res) => { - if (typeof healthCheck.data === 'function') return res.json(healthCheck.data()) - if (healthCheck.data) return res.json(healthCheck.data) - - res.json({ - status: 'pass', - timestamp: Date.now(), - }) - }) - } - await config.server?.extendExpressApp?.(expressServer, context) - await config.server?.extendHttpServer?.(httpServer, context, context.graphql.schema) + await config.server?.extendHttpServer?.(httpServer, context) if (config.storage) { for (const val of Object.values(config.storage)) { diff --git a/packages/core/src/lib/createGraphQLSchema.ts b/packages/core/src/lib/createGraphQLSchema.ts index 0c611ab3b19..9631f385217 100644 --- a/packages/core/src/lib/createGraphQLSchema.ts +++ b/packages/core/src/lib/createGraphQLSchema.ts @@ -127,9 +127,5 @@ export function createGraphQLSchema ( ) // merge in the user defined graphQL API - if (config.extendGraphqlSchema) { - return config.extendGraphqlSchema(graphQLSchema) - } - - return graphQLSchema + return config.graphql?.extendGraphqlSchema?.(graphQLSchema) ?? graphQLSchema } diff --git a/packages/core/src/schema.ts b/packages/core/src/schema.ts index 61ee48066d8..6e500b800de 100644 --- a/packages/core/src/schema.ts +++ b/packages/core/src/schema.ts @@ -11,10 +11,7 @@ export function config (config: KeystoneC } let i = 0 -export function group< - __Unused extends any, // TODO: remove in breaking change - ListTypeInfo extends BaseListTypeInfo -> (config: { +export function group (config: { label: string description?: string fields: BaseFields @@ -34,9 +31,6 @@ export function group< } as any // TODO: FIXME, see initialise-lists.ts:getListsWithInitialisedFields } -export function list< - __Unused extends any, // TODO: remove in breaking change - ListTypeInfo extends BaseListTypeInfo -> (config: ListConfig): ListConfig { +export function list (config: ListConfig): ListConfig { return { ...config } } diff --git a/packages/core/src/scripts/dev.ts b/packages/core/src/scripts/dev.ts index 4a02a998e6e..055808df28d 100644 --- a/packages/core/src/scripts/dev.ts +++ b/packages/core/src/scripts/dev.ts @@ -149,7 +149,7 @@ export async function dev ( }) if (configWithExtendHttp?.server?.extendHttpServer && httpServer && context) { - configWithExtendHttp.server.extendHttpServer(httpServer, context, graphQLSchema) + configWithExtendHttp.server.extendHttpServer(httpServer, context) } prismaClient = context?.prisma @@ -223,7 +223,7 @@ export async function dev ( if (prismaClientModule) { if (server && lastApolloServer) { const { context: newContext } = getKeystone(prismaClientModule) - const servers = await createExpressServer(newConfig, null, newContext) + const servers = await createExpressServer(newConfig, newContext) if (nextApp) { servers.expressServer.use( createAdminUIMiddlewareWithNextApp(newConfig, newContext, nextApp) @@ -389,7 +389,6 @@ async function setupInitialKeystone ( console.log('✨ Creating server') const { apolloServer, expressServer } = await createExpressServer( config, - graphQLSchema, keystone.context ) console.log(`✅ GraphQL API ready`) diff --git a/packages/core/src/scripts/start.ts b/packages/core/src/scripts/start.ts index 40401fba76d..dadb23b85a0 100644 --- a/packages/core/src/scripts/start.ts +++ b/packages/core/src/scripts/start.ts @@ -43,7 +43,7 @@ export async function start ( await keystone.connect() console.log('✨ Creating server') - const { expressServer, httpServer } = await createExpressServer(config, null, keystone.context) + const { expressServer, httpServer } = await createExpressServer(config, keystone.context) console.log(`✅ GraphQL API ready`) if (!config.ui?.isDisabled && ui) { diff --git a/packages/core/src/system.ts b/packages/core/src/system.ts index 1e594287295..795cc3ff80e 100644 --- a/packages/core/src/system.ts +++ b/packages/core/src/system.ts @@ -116,6 +116,7 @@ function resolveDefaults (config: KeystoneConfig) { path: '/api/graphql', playground: process.env.NODE_ENV !== 'production', schemaPath: 'schema.graphql', + extendGraphqlSchema: config.graphql?.extendGraphqlSchema ?? ((s) => s), ...config.graphql, }, lists: injectDefaults(config, defaultIdField), @@ -126,8 +127,6 @@ function resolveDefaults (config: KeystoneConfig) { ...config.server, cors, }, - // TODO: remove in breaking change, move to .graphql.extendSchema - extendGraphqlSchema: config.extendGraphqlSchema ?? ((s) => s), storage: { ...config?.storage }, diff --git a/packages/core/src/types/config/index.ts b/packages/core/src/types/config/index.ts index 2c746b67018..e4916fe0980 100644 --- a/packages/core/src/types/config/index.ts +++ b/packages/core/src/types/config/index.ts @@ -11,7 +11,6 @@ import type { AssetMode, BaseKeystoneTypeInfo, KeystoneContext, DatabaseProvider import type { SessionStrategy } from '../session' import type { MaybePromise } from '../utils' import type { - ListSchemaConfig, ListConfig, MaybeSessionFunction, MaybeItemFunction, @@ -96,16 +95,13 @@ export type StorageConfig = ( export type KeystoneConfig = { db: DatabaseConfig graphql?: GraphQLConfig - lists: ListSchemaConfig - ui?: AdminUIConfig + lists: Record> server?: ServerConfig session?: SessionStrategy types?: { path?: string } - // TODO: why isn't this within .graphql? - extendGraphqlSchema?: (schema: GraphQLSchema) => GraphQLSchema /** An object containing configuration about keystone's various external storages. * * Each entry should be of either `kind: 'local'` or `kind: 's3'`, and follow the configuration of each. @@ -116,18 +112,13 @@ export type KeystoneConfig /** Telemetry boolean to disable telemetry for this project */ telemetry?: boolean - /** Experimental config options */ - experimental?: { - /** Adds the internal data structure `experimental.initialisedLists` to the context object. - * This is not a stable API and may contain breaking changes in `patch` level releases. - */ - contextInitialisedLists?: boolean - } + + ui?: AdminUIConfig } // config.lists -export type { ListSchemaConfig, ListConfig, BaseFields, MaybeSessionFunction, MaybeItemFunction } +export type { ListConfig, BaseFields, MaybeSessionFunction, MaybeItemFunction } // config.db @@ -154,10 +145,6 @@ export type DatabaseConfig = { /** @deprecated */ useMigrations?: boolean - /** @deprecated use extendPrismaSchema */ - prismaPreviewFeatures?: readonly string[] // https://www.prisma.io/docs/concepts/components/preview-features - /** @deprecated use extendPrismaSchema */ - additionalPrismaDatasourceProperties?: { [key: string]: string } } // config.ui @@ -175,9 +162,7 @@ export type AdminUIConfig = { /** The Base Path for Keystones Admin UI */ basePath?: string - getAdditionalFiles?: readonly (( - config: KeystoneConfig - ) => MaybePromise)[] + getAdditionalFiles?: readonly (() => MaybePromise)[] /** An async middleware function that can optionally return a redirect */ pageMiddleware?: (args: { @@ -198,14 +183,6 @@ export type ServerConfig = { /** Maximum upload file size allowed (in bytes) */ maxFileSize?: number - /** @deprecated */ - healthCheck?: - | true - | { - path?: string - data?: Record | (() => Record) - } - /** extend the Express application used by Keystone */ extendExpressApp?: ( app: express.Express, @@ -216,8 +193,6 @@ export type ServerConfig = { extendHttpServer?: ( server: Server, context: KeystoneContext, - /** @deprecated, TODO: redundant, prefer context.graphql.schema, remove in breaking change */ - graphqlSchema: GraphQLSchema ) => MaybePromise } & ( | { @@ -272,11 +247,11 @@ export type GraphQLConfig { - * console.error(err); - * delete err.extensions?.errors; - * delete err.extensions?.exception?.errors; - * delete err.extensions?.exception?.stacktrace; - * return err; + * console.error(err) + * delete err.extensions?.errors + * delete err.extensions?.exception?.errors + * delete err.extensions?.exception?.stacktrace + * return err * }, * }, * } @@ -291,10 +266,13 @@ export type GraphQLConfig GraphQLSchema + /** + * A function that receives the Keystone GraphQL schema for the developer to extend + * @default 'schema.graphql' + */ + extendGraphqlSchema?: (schema: GraphQLSchema) => GraphQLSchema +} export type FilesConfig = { upload: AssetMode diff --git a/packages/core/src/types/config/lists.ts b/packages/core/src/types/config/lists.ts index 1ebadec5f48..fe4f8240c6d 100644 --- a/packages/core/src/types/config/lists.ts +++ b/packages/core/src/types/config/lists.ts @@ -6,16 +6,7 @@ import type { ListHooks } from './hooks' import type { ListAccessControl } from './access-control' import type { BaseFields, FilterOrderArgs } from './fields' -// TODO: inline -export type ListSchemaConfig = Record< - string, - ListConfig> -> - -export type ListConfig< - ListTypeInfo extends BaseListTypeInfo, - __Unused extends any = any // TODO: remove in breaking change -> = { +export type ListConfig = { isSingleton?: boolean fields: BaseFields @@ -54,10 +45,7 @@ export type ListConfig< defaultIsOrderable?: boolean | ((args: FilterOrderArgs) => MaybePromise) } -export type ListAdminUIConfig< - ListTypeInfo extends BaseListTypeInfo, - __Unused extends any = any // TODO: remove in breaking change -> = { +export type ListAdminUIConfig = { /** * The field to use as a label in the Admin UI. If you want to base the label off more than a single field, use a virtual field and reference that field here. * @default 'label', if it exists, falling back to 'name', then 'title', and finally 'id', which is guaranteed to exist. diff --git a/packages/core/src/types/context.ts b/packages/core/src/types/context.ts index d19137e9ac1..c4cbcef951a 100644 --- a/packages/core/src/types/context.ts +++ b/packages/core/src/types/context.ts @@ -13,7 +13,6 @@ export type KeystoneContext graphql: KeystoneGraphQLAPI sudo: () => KeystoneContext - exitSudo: () => KeystoneContext withSession: (session?: TypeInfo['session']) => KeystoneContext withRequest: (req: IncomingMessage, res?: ServerResponse) => Promise> prisma: TypeInfo['prisma'] @@ -22,21 +21,12 @@ export type KeystoneContext session?: TypeInfo['session'] - /** @deprecated */ - gqlNames: (listKey: string) => InitialisedList['graphql']['names'] - - /** @deprecated */ - experimental?: { - /** @deprecated This value is only available if you have config.experimental.contextInitialisedLists = true. - * This is not a stable API and may contain breaking changes in `patch` level releases. - */ - initialisedLists: Record - } /** * WARNING: may change in patch */ __internal: { + lists: Record prisma: { DbNull: unknown JsonNull: unknown diff --git a/packages/core/src/types/session.ts b/packages/core/src/types/session.ts index 972c1b42c41..c8f763ddf07 100644 --- a/packages/core/src/types/session.ts +++ b/packages/core/src/types/session.ts @@ -11,18 +11,14 @@ export type SessionStrategy< } /** @deprecated */ -export type SessionStore< - Session = any // TODO: remove any in breaking change -> = { +export type SessionStore = { get(key: string): MaybePromise set(key: string, value: Session): void | Promise delete(key: string): void | Promise } /** @deprecated */ -export type SessionStoreFunction< - Session = any // TODO: remove any in breaking change -> = (args: { +export type SessionStoreFunction = (args: { /** * The number of seconds that a cookie session be valid for */ diff --git a/packages/fields-document/src/relationship-data.tsx b/packages/fields-document/src/relationship-data.tsx index f3b29991026..08ba598e0e7 100644 --- a/packages/fields-document/src/relationship-data.tsx +++ b/packages/fields-document/src/relationship-data.tsx @@ -91,7 +91,7 @@ export async function fetchRelationshipData ( const labelField = getLabelFieldsForLists(context.graphql.schema)[listKey] const val = (await context.graphql.run({ query: `query($ids: [ID!]!) {items:${ - context.gqlNames(listKey).listQueryName + context.__internal.lists[listKey].graphql.names.listQueryName }(where: { id: { in: $ids } }) {${idFieldAlias}:id ${labelFieldAlias}:${labelField}\n${ selection || '' }}}`, @@ -122,7 +122,7 @@ async function fetchDataForOne ( // errors from the GraphQL field resolver. const val = (await context.graphql.run({ query: `query($id: ID!) {item:${ - context.gqlNames(listKey).itemQueryName + context.__internal.lists[listKey].graphql.names.itemQueryName }(where: {id:$id}) {${labelFieldAlias}:${labelField}\n${selection}}}`, variables: { id }, })) as { item: Record | null } diff --git a/packages/fields-document/src/structure-graphql-input.tsx b/packages/fields-document/src/structure-graphql-input.tsx index 6556d5553c1..0b3de2630cf 100644 --- a/packages/fields-document/src/structure-graphql-input.tsx +++ b/packages/fields-document/src/structure-graphql-input.tsx @@ -460,7 +460,7 @@ async function handleCreateAndUpdate ( async function resolveCreateMutation (value: any, context: KeystoneContext, foreignListKey: string) { const mutationType = context.graphql.schema.getMutationType()! const { id } = (await mutationType.getFields()[ - context.gqlNames(foreignListKey).createMutationName + context.__internal.lists[foreignListKey].graphql.names.createMutationName ].resolve!( {}, { data: value.create }, diff --git a/tests/api-tests/admin-meta.test.ts b/tests/api-tests/admin-meta.test.ts index df688a5c499..806045ae4d9 100644 --- a/tests/api-tests/admin-meta.test.ts +++ b/tests/api-tests/admin-meta.test.ts @@ -38,7 +38,7 @@ const runner = setupTestRunner({ test( 'non-sudo context does not bypass isAccessAllowed for admin meta', runner(async ({ context }) => { - const res = await context.exitSudo().graphql.raw({ query: staticAdminMetaQuery }) + const res = await context.graphql.raw({ query: staticAdminMetaQuery }) expect(res).toMatchInlineSnapshot(` { "data": null, diff --git a/tests/api-tests/extend-graphql-schema.test.ts b/tests/api-tests/extend-graphql-schema.test.ts index b9f4dadfb45..f1ceeae6dee 100644 --- a/tests/api-tests/extend-graphql-schema.test.ts +++ b/tests/api-tests/extend-graphql-schema.test.ts @@ -32,29 +32,31 @@ const runner = setupTestRunner({ fields: { name: text() }, }), }, - extendGraphqlSchema: graphql.extend(() => { - return { - mutation: { - triple: graphql.field({ - type: graphql.Int, - args: { x: graphql.arg({ type: graphql.nonNull(graphql.Int) }) }, - resolve: withAccessCheck(true, (_, { x }: { x: number }) => 3 * x), - }), - }, - query: { - double: graphql.field({ - type: graphql.Int, - args: { x: graphql.arg({ type: graphql.nonNull(graphql.Int) }) }, - resolve: withAccessCheck(true, (_, { x }: { x: number }) => 2 * x), - }), - quads: graphql.field({ - type: graphql.Int, - args: { x: graphql.arg({ type: graphql.nonNull(graphql.Int) }) }, - resolve: withAccessCheck(falseFn, (_, { x }: { x: number }) => 4 * x), - }), - }, - } - }) + graphql: { + extendGraphqlSchema: graphql.extend(() => { + return { + mutation: { + triple: graphql.field({ + type: graphql.Int, + args: { x: graphql.arg({ type: graphql.nonNull(graphql.Int) }) }, + resolve: withAccessCheck(true, (_, { x }: { x: number }) => 3 * x), + }), + }, + query: { + double: graphql.field({ + type: graphql.Int, + args: { x: graphql.arg({ type: graphql.nonNull(graphql.Int) }) }, + resolve: withAccessCheck(true, (_, { x }: { x: number }) => 2 * x), + }), + quads: graphql.field({ + type: graphql.Int, + args: { x: graphql.arg({ type: graphql.nonNull(graphql.Int) }) }, + resolve: withAccessCheck(falseFn, (_, { x }: { x: number }) => 4 * x), + }), + }, + } + }) + } }), }) diff --git a/tests/api-tests/fields/types/relationship.test.ts b/tests/api-tests/fields/types/relationship.test.ts index c708c449835..7298e5f0c60 100644 --- a/tests/api-tests/fields/types/relationship.test.ts +++ b/tests/api-tests/fields/types/relationship.test.ts @@ -1,6 +1,7 @@ import { assertInputObjectType, printType, assertObjectType, parse } from 'graphql' import { createSystem, initConfig } from '@keystone-6/core/system' -import type { ListSchemaConfig } from '@keystone-6/core/types' +import { type KeystoneConfig } from '@keystone-6/core/types' + import { config, list } from '@keystone-6/core' import { text, relationship } from '@keystone-6/core/fields' import { allowAll } from '@keystone-6/core/access' @@ -136,7 +137,7 @@ describe('Type Generation', () => { }) describe('Reference errors', () => { - function tryf (lists: ListSchemaConfig) { + function tryf (lists: KeystoneConfig['lists']) { return createSystem( initConfig( config({ diff --git a/tests/api-tests/healthcheck.test.ts b/tests/api-tests/healthcheck.test.ts deleted file mode 100644 index 63d61f8cbdd..00000000000 --- a/tests/api-tests/healthcheck.test.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { list } from '@keystone-6/core' -import { allowAll } from '@keystone-6/core/access' -import { text } from '@keystone-6/core/fields' -import { setupTestRunner } from '@keystone-6/api-tests/test-runner' -import supertest from 'supertest' - -function runner (healthCheck: any) { - return setupTestRunner({ - serve: true, - config: { - lists: { - User: list({ - access: allowAll, - fields: { - name: text() - } - }), - }, - server: { healthCheck }, - }, - }) -} - -test('No health check', runner(undefined)(async ({ express }) => { - await supertest(express).get('/_healthcheck').set('Accept', 'expresslication/json').expect(404) -})) - -test('Default health check', runner(true)(async ({ express }) => { - const { text } = await supertest(express) - .get('/_healthcheck') - .set('Accept', 'expresslication/json') - .expect('Content-Type', /json/) - .expect(200) - - expect(JSON.parse(text)).toEqual({ - status: 'pass', - timestamp: expect.any(Number), - }) -})) - -test('Custom path', runner({ path: '/custom' })(async ({ express }) => { - const { text } = await supertest(express) - .get('/custom') - .set('Accept', 'expresslication/json') - .expect('Content-Type', /json/) - .expect(200) - expect(JSON.parse(text)).toEqual({ - status: 'pass', - timestamp: expect.any(Number), - }) -})) - -test('Custom data: object', runner({ data: { foo: 'bar' } })(async ({ express }) => { - const { text } = await supertest(express) - .get('/_healthcheck') - .set('Accept', 'expresslication/json') - .expect('Content-Type', /json/) - .expect(200) - expect(JSON.parse(text)).toEqual({ foo: 'bar' }) -})) - -test('Custom data: function', runner({ data: () => ({ foo: 'bar' }) })(async ({ express }) => { - const { text } = await supertest(express) - .get('/_healthcheck') - .set('Accept', 'expresslication/json') - .expect('Content-Type', /json/) - .expect(200) - expect(JSON.parse(text)).toEqual({ foo: 'bar' }) -})) diff --git a/tests/api-tests/queries/cache-hints.test.ts b/tests/api-tests/queries/cache-hints.test.ts index 69d3b3a36bc..9ed2aaa658b 100644 --- a/tests/api-tests/queries/cache-hints.test.ts +++ b/tests/api-tests/queries/cache-hints.test.ts @@ -44,35 +44,37 @@ const runner = setupTestRunner({ }, }), }, - extendGraphqlSchema: graphql.extend(() => { - const MyType = graphql.object<{ original: number }>()({ - name: 'MyType', - fields: { - original: graphql.field({ type: graphql.Int }), - double: graphql.field({ type: graphql.Int, resolve: ({ original }) => original * 2 }), - }, - }) - return { - query: { - double: graphql.field({ - type: MyType, - args: { x: graphql.arg({ type: graphql.nonNull(graphql.Int) }) }, - resolve: (_, { x }, context, info) => { - maybeCacheControlFromInfo(info)?.setCacheHint({ maxAge: 100, scope: 'PUBLIC' }) - return { original: x, double: x * 2 } - }, - }), - }, - mutation: { - triple: graphql.field({ - type: graphql.Int, - args: { x: graphql.arg({ type: graphql.nonNull(graphql.Int) }) }, - resolve: (_, { x }) => x * 3, - }), - }, - } - }), - }, + graphql: { + extendGraphqlSchema: graphql.extend(() => { + const MyType = graphql.object<{ original: number }>()({ + name: 'MyType', + fields: { + original: graphql.field({ type: graphql.Int }), + double: graphql.field({ type: graphql.Int, resolve: ({ original }) => original * 2 }), + }, + }) + return { + query: { + double: graphql.field({ + type: MyType, + args: { x: graphql.arg({ type: graphql.nonNull(graphql.Int) }) }, + resolve: (_, { x }, context, info) => { + maybeCacheControlFromInfo(info)?.setCacheHint({ maxAge: 100, scope: 'PUBLIC' }) + return { original: x, double: x * 2 } + }, + }), + }, + mutation: { + triple: graphql.field({ + type: graphql.Int, + args: { x: graphql.arg({ type: graphql.nonNull(graphql.Int) }) }, + resolve: (_, { x }) => x * 3, + }), + }, + } + }), + } + } }) const addFixtures = async (context: ContextFromRunner) => { diff --git a/tests/api-tests/test-runner.ts b/tests/api-tests/test-runner.ts index 22ff51f855b..431666f4fe3 100644 --- a/tests/api-tests/test-runner.ts +++ b/tests/api-tests/test-runner.ts @@ -145,7 +145,7 @@ export async function setupTestEnv ({ const { expressServer: express, httpServer: http - } = await createExpressServer(config, context.graphql.schema, context) + } = await createExpressServer(config, context) function gqlSuper (...args: Parameters) { return supertest(express) diff --git a/tests/sandbox/configs/7590-add-item-to-relationship-in-hook-cards-ui.ts b/tests/sandbox/configs/7590-add-item-to-relationship-in-hook-cards-ui.ts index db5cb5a4894..5bd8853e16b 100644 --- a/tests/sandbox/configs/7590-add-item-to-relationship-in-hook-cards-ui.ts +++ b/tests/sandbox/configs/7590-add-item-to-relationship-in-hook-cards-ui.ts @@ -38,4 +38,7 @@ export const lists = { }), } -export default config({ db: dbConfig, lists }) +export default config({ + db: dbConfig, + lists +}) diff --git a/tests/sandbox/utils.ts b/tests/sandbox/utils.ts index e05c29f3b75..1dd0a0f61c1 100644 --- a/tests/sandbox/utils.ts +++ b/tests/sandbox/utils.ts @@ -1,5 +1,5 @@ import { timestamp } from '@keystone-6/core/fields' -import { type BaseKeystoneTypeInfo, type DatabaseConfig, type StorageConfig } from '@keystone-6/core/types' +import { type StorageConfig } from '@keystone-6/core/types' export const localStorageConfig: Record = { images: { @@ -29,9 +29,9 @@ export const fixPrismaPath = { prismaClientPath: 'node_modules/.testprisma/client', } -export const dbConfig: DatabaseConfig = { - provider: 'sqlite', - url: process.env.DATABASE_URL || 'file:./dev.db', +export const dbConfig = { + provider: 'sqlite' as const, + url: process.env.DATABASE_URL ?? 'file:./dev.db', ...fixPrismaPath, } diff --git a/tests/test-projects/live-reloading/keystone.ts b/tests/test-projects/live-reloading/keystone.ts index d19cef83f2c..62b86624edb 100644 --- a/tests/test-projects/live-reloading/keystone.ts +++ b/tests/test-projects/live-reloading/keystone.ts @@ -11,7 +11,9 @@ export default config({ ...fixPrismaPath, }, lists, - extendGraphqlSchema, + graphql: { + extendGraphqlSchema + }, ui: { getAdditionalFiles: [ () => [