diff --git a/.changeset/blue-balloons-turn.md b/.changeset/blue-balloons-turn.md new file mode 100644 index 00000000000..cbe28da7286 --- /dev/null +++ b/.changeset/blue-balloons-turn.md @@ -0,0 +1,6 @@ +--- +"@keystone-6/core": major +--- + +Renamed `__ResolvedKeystoneConfig` to `ResolvedKeystoneConfig`. +Changed `config` function to return config with defaults instead of just type casting. This now returns `ResolvedKeystoneConfig` instead of `KeystoneConfig` diff --git a/.changeset/shaggy-beds-know.md b/.changeset/shaggy-beds-know.md new file mode 100644 index 00000000000..c7d8536ea0b --- /dev/null +++ b/.changeset/shaggy-beds-know.md @@ -0,0 +1,5 @@ +--- +"@keystone-6/auth": major +--- + +Changed type of `withAuth` input to `ResolvedKeystoneConfig` instead of `KeystoneConfig` diff --git a/packages/auth/src/index.ts b/packages/auth/src/index.ts index 68448486a4c..607e79f3626 100644 --- a/packages/auth/src/index.ts +++ b/packages/auth/src/index.ts @@ -1,10 +1,10 @@ import type { AdminFileToWrite, BaseListTypeInfo, - KeystoneConfig, KeystoneContext, SessionStrategy, BaseKeystoneTypeInfo, + ResolvedKeystoneConfig, } from '@keystone-6/core/types' import { password, timestamp } from '@keystone-6/core/fields' @@ -134,7 +134,7 @@ export function createAuth ({ }) function throwIfInvalidConfig ( - config: KeystoneConfig + config: ResolvedKeystoneConfig ) { if (!(listKey in config.lists)) { throw new Error(`withAuth cannot find the list "${listKey}"`) @@ -247,8 +247,8 @@ export function createAuth ({ * Automatically extends your configuration with a prescriptive implementation. */ function withAuth ( - config: KeystoneConfig - ): KeystoneConfig { + config: ResolvedKeystoneConfig + ): ResolvedKeystoneConfig { throwIfInvalidConfig(config) let { ui } = config if (!ui?.isDisabled) { diff --git a/packages/core/src/admin-ui/system/generateAdminUI.ts b/packages/core/src/admin-ui/system/generateAdminUI.ts index 35aabf60571..0c92133064b 100644 --- a/packages/core/src/admin-ui/system/generateAdminUI.ts +++ b/packages/core/src/admin-ui/system/generateAdminUI.ts @@ -7,7 +7,7 @@ import { type GraphQLSchema } from 'graphql' import { type Entry, walk as _walk } from '@nodelib/fs.walk' import { type AdminFileToWrite, - type __ResolvedKeystoneConfig + type ResolvedKeystoneConfig } from '../../types' import { writeAdminFiles } from '../templates' import { type AdminMetaRootVal } from '../../lib/create-admin-meta' @@ -66,7 +66,7 @@ export async function writeAdminFile (file: AdminFileToWrite, projectAdminPath: const pageExtensions = new Set(['.js', '.jsx', '.ts', '.tsx']) export async function generateAdminUI ( - config: __ResolvedKeystoneConfig, + config: ResolvedKeystoneConfig, graphQLSchema: GraphQLSchema, adminMeta: AdminMetaRootVal, projectAdminPath: string, diff --git a/packages/core/src/admin-ui/templates/index.ts b/packages/core/src/admin-ui/templates/index.ts index eaf284d4f7e..b75c8c83d07 100644 --- a/packages/core/src/admin-ui/templates/index.ts +++ b/packages/core/src/admin-ui/templates/index.ts @@ -1,8 +1,6 @@ import * as Path from 'path' import { type GraphQLSchema } from 'graphql' -import { - type __ResolvedKeystoneConfig -} from '../../types' +import { type ResolvedKeystoneConfig } from '../../types' import { type AdminMetaRootVal } from '../../lib/create-admin-meta' import { appTemplate } from './app' import { homeTemplate } from './home' @@ -14,7 +12,8 @@ import { nextConfigTemplate } from './next-config' const pkgDir = Path.dirname(require.resolve('@keystone-6/core/package.json')) -export function writeAdminFiles (config: __ResolvedKeystoneConfig, +export function writeAdminFiles ( + config: ResolvedKeystoneConfig, graphQLSchema: GraphQLSchema, adminMeta: AdminMetaRootVal, configFileExists: boolean diff --git a/packages/core/src/artifacts.ts b/packages/core/src/artifacts.ts index fa7243d7c04..f9959c394e9 100644 --- a/packages/core/src/artifacts.ts +++ b/packages/core/src/artifacts.ts @@ -5,7 +5,6 @@ import { type ChildProcess } from 'node:child_process' import { printSchema } from 'graphql' import { getGenerators, formatSchema } from '@prisma/internals' import { ExitError } from './scripts/utils' -import { type __ResolvedKeystoneConfig } from './types' import { initialiseLists } from './lib/core/initialise-lists' import { type System, diff --git a/packages/core/src/context.ts b/packages/core/src/context.ts index 180ef011d2e..8bb8338227c 100644 --- a/packages/core/src/context.ts +++ b/packages/core/src/context.ts @@ -1,12 +1,12 @@ import { type BaseKeystoneTypeInfo, - type KeystoneConfig, + type ResolvedKeystoneConfig, type KeystoneContext } from './types' import { createSystem } from './lib/createSystem' export function getContext ( - config: KeystoneConfig, + config: ResolvedKeystoneConfig, PrismaModule: unknown ): KeystoneContext { const system = createSystem(config) diff --git a/packages/core/src/lib/assets/createFilesContext.ts b/packages/core/src/lib/assets/createFilesContext.ts index 48e7a3cb36f..9391d9092f7 100644 --- a/packages/core/src/lib/assets/createFilesContext.ts +++ b/packages/core/src/lib/assets/createFilesContext.ts @@ -2,7 +2,7 @@ import { randomBytes } from 'node:crypto' import { type FilesContext, - type __ResolvedKeystoneConfig, + type ResolvedKeystoneConfig, } from '../../types' import { localFileAssetsAPI } from './local' import { s3FileAssetsAPI } from './s3' @@ -21,7 +21,7 @@ function defaultTransformName (path: string) { return `${urlSafeName}-${id}` } -export function createFilesContext (config: __ResolvedKeystoneConfig): FilesContext { +export function createFilesContext (config: ResolvedKeystoneConfig): FilesContext { const adaptersMap = new Map() for (const [storageKey, storageConfig] of Object.entries(config.storage || {})) { diff --git a/packages/core/src/lib/assets/createImagesContext.ts b/packages/core/src/lib/assets/createImagesContext.ts index 8a2d1a6d7e1..46b714dd6c0 100644 --- a/packages/core/src/lib/assets/createImagesContext.ts +++ b/packages/core/src/lib/assets/createImagesContext.ts @@ -3,7 +3,7 @@ import imageSize from 'image-size' import { type ImagesContext, - type __ResolvedKeystoneConfig, + type ResolvedKeystoneConfig, } from '../../types' import type { ImageAdapter } from './types' import { localImageAssetsAPI } from './local' @@ -33,7 +33,7 @@ async function getImageMetadataFromBuffer (buffer: Buffer) { return { width, height, filesize: buffer.length, extension } } -export function createImagesContext (config: __ResolvedKeystoneConfig): ImagesContext { +export function createImagesContext (config: ResolvedKeystoneConfig): ImagesContext { const imageAssetsAPIs = new Map() for (const [storageKey, storageConfig] of Object.entries(config.storage || {})) { if (storageConfig.type === 'image') { diff --git a/packages/core/src/lib/context/createContext.ts b/packages/core/src/lib/context/createContext.ts index 138494c3e2d..687c565b63c 100644 --- a/packages/core/src/lib/context/createContext.ts +++ b/packages/core/src/lib/context/createContext.ts @@ -11,7 +11,7 @@ import { import { type KeystoneContext, type KeystoneGraphQLAPI, - type __ResolvedKeystoneConfig, + type ResolvedKeystoneConfig, } from '../../types' import { type InitialisedList } from '../core/initialise-lists' @@ -27,7 +27,7 @@ export function createContext ({ prismaClient, prismaTypes }: { - config: __ResolvedKeystoneConfig + config: ResolvedKeystoneConfig lists: Record graphQLSchema: GraphQLSchema graphQLSchemaSudo: GraphQLSchema diff --git a/packages/core/src/lib/core/initialise-lists.ts b/packages/core/src/lib/core/initialise-lists.ts index 191e2ff2807..acb88e34e78 100644 --- a/packages/core/src/lib/core/initialise-lists.ts +++ b/packages/core/src/lib/core/initialise-lists.ts @@ -8,7 +8,7 @@ import { type GraphQLTypesForList, type ListGraphQLTypes, type ListHooks, - type __ResolvedKeystoneConfig, + type ResolvedKeystoneConfig, type MaybePromise, type NextFieldType, type FieldTypeFunc, @@ -153,7 +153,7 @@ function throwIfNotAFilter (x: unknown, listKey: string, fieldKey: string) { throw new Error(`Configuration option '${listKey}.${fieldKey}' must be either a boolean value or a function. Received '${x}'.`) } -type ListConfigType = __ResolvedKeystoneConfig['lists'][string] +type ListConfigType = ResolvedKeystoneConfig['lists'][string] type FieldConfigType = ReturnType> type PartiallyInitialisedList1 = { graphql: { isEnabled: IsListEnabled } } type PartiallyInitialisedList2 = Omit @@ -374,7 +374,7 @@ function parseFieldHooks ( } function getListsWithInitialisedFields ( - config: __ResolvedKeystoneConfig, + config: ResolvedKeystoneConfig, listsRef: Record, ) { const { storage: configStorage, lists: listsConfig, db: { provider } } = config @@ -872,7 +872,7 @@ function graphqlForOutputField (field: InitialisedField) { }) } -export function initialiseLists (config: __ResolvedKeystoneConfig): Record { +export function initialiseLists (config: ResolvedKeystoneConfig): Record { const listsRef: Record = {} let intermediateLists diff --git a/packages/core/src/lib/core/prisma-schema-printer.ts b/packages/core/src/lib/core/prisma-schema-printer.ts index 3856cdbe6ea..09bfec300a2 100644 --- a/packages/core/src/lib/core/prisma-schema-printer.ts +++ b/packages/core/src/lib/core/prisma-schema-printer.ts @@ -4,9 +4,7 @@ import { } from '../../types' import { type ResolvedDBField } from './resolve-relationships' import { type InitialisedList } from './initialise-lists' -import { - type __ResolvedKeystoneConfig -} from '../../types' +import { type ResolvedKeystoneConfig } from '../../types' import { areArraysEqual, getDBFieldKeyForFieldOnMultiField } from './utils' const modifiers = { @@ -183,7 +181,7 @@ function assertDbFieldIsValidForIdField ( } export function printPrismaSchema ( - config: __ResolvedKeystoneConfig, + config: ResolvedKeystoneConfig, lists: Record, ) { const { diff --git a/packages/core/src/lib/create-admin-meta.ts b/packages/core/src/lib/create-admin-meta.ts index 7785a90c537..979cdab4bb3 100644 --- a/packages/core/src/lib/create-admin-meta.ts +++ b/packages/core/src/lib/create-admin-meta.ts @@ -6,7 +6,7 @@ import { type MaybeItemFunction, type MaybePromise, type MaybeSessionFunction, - type __ResolvedKeystoneConfig, + type ResolvedKeystoneConfig, } from '../types' import { type GraphQLNames @@ -85,7 +85,7 @@ export type AdminMetaRootVal = { } export function createAdminMeta ( - config: __ResolvedKeystoneConfig, + config: ResolvedKeystoneConfig, initialisedLists: Record ) { const { lists } = config diff --git a/packages/core/src/lib/createAdminUIMiddleware.ts b/packages/core/src/lib/createAdminUIMiddleware.ts index 151136791ec..a309fd89c98 100644 --- a/packages/core/src/lib/createAdminUIMiddleware.ts +++ b/packages/core/src/lib/createAdminUIMiddleware.ts @@ -4,14 +4,14 @@ import type express from 'express' import type next from 'next' import { type KeystoneContext, - type __ResolvedKeystoneConfig, + type ResolvedKeystoneConfig, } from '../types' import { pkgDir } from '../pkg-dir' const adminErrorHTMLFilepath = path.join(pkgDir, 'static', 'admin-error.html') export function createAdminUIMiddlewareWithNextApp ( - config: __ResolvedKeystoneConfig, + config: ResolvedKeystoneConfig, commonContext: KeystoneContext, nextApp: ReturnType ) { diff --git a/packages/core/src/lib/createExpressServer.ts b/packages/core/src/lib/createExpressServer.ts index a63af48780e..23c41b7cb48 100644 --- a/packages/core/src/lib/createExpressServer.ts +++ b/packages/core/src/lib/createExpressServer.ts @@ -13,7 +13,7 @@ import { ApolloServerPluginLandingPageLocalDefault } from '@apollo/server/plugin import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.js' import { type KeystoneContext, - type __ResolvedKeystoneConfig, + type ResolvedKeystoneConfig, } from '../types' /* @@ -24,7 +24,7 @@ The Admin UI takes a while to build for dev, and is created separately so the CLI can bring up the dev server early to handle GraphQL requests. */ -function formatError (graphqlConfig: __ResolvedKeystoneConfig['graphql']) { +function formatError (graphqlConfig: ResolvedKeystoneConfig['graphql']) { return (formattedError: GraphQLFormattedError, error: unknown) => { let debug = graphqlConfig.debug if (debug === undefined) { @@ -46,7 +46,7 @@ function formatError (graphqlConfig: __ResolvedKeystoneConfig['graphql']) { } export async function createExpressServer ( - config: Pick<__ResolvedKeystoneConfig, 'graphql' | 'server' | 'storage'>, + config: Pick, context: KeystoneContext ): Promise<{ expressServer: express.Express diff --git a/packages/core/src/lib/createGraphQLSchema.ts b/packages/core/src/lib/createGraphQLSchema.ts index 5e4dff60a6e..71ac300cd08 100644 --- a/packages/core/src/lib/createGraphQLSchema.ts +++ b/packages/core/src/lib/createGraphQLSchema.ts @@ -2,7 +2,7 @@ import { type GraphQLNamedType, GraphQLSchema } from 'graphql' import { graphql } from '../types/schema' import { - type __ResolvedKeystoneConfig + type ResolvedKeystoneConfig } from '../types' import { KeystoneMeta } from './resolve-admin-meta' import type { AdminMetaRootVal } from './create-admin-meta' @@ -98,7 +98,7 @@ function collectTypes ( } export function createGraphQLSchema ( - config: __ResolvedKeystoneConfig, + config: ResolvedKeystoneConfig, lists: Record, adminMeta: AdminMetaRootVal | null, sudo: boolean diff --git a/packages/core/src/lib/createSystem.ts b/packages/core/src/lib/createSystem.ts index 78b039d8627..838d7a66fc1 100644 --- a/packages/core/src/lib/createSystem.ts +++ b/packages/core/src/lib/createSystem.ts @@ -3,7 +3,7 @@ import { randomBytes } from 'node:crypto' import { type KeystoneConfig, type FieldData, - type __ResolvedKeystoneConfig + type ResolvedKeystoneConfig } from '../types' import { GraphQLError } from 'graphql' @@ -26,7 +26,7 @@ function posixify (s: string) { return s.split(path.sep).join('/') } -export function getSystemPaths (cwd: string, config: KeystoneConfig | __ResolvedKeystoneConfig) { +export function getSystemPaths (cwd: string, config: KeystoneConfig | ResolvedKeystoneConfig) { const prismaClientPath = config.db.prismaClientPath === '@prisma/client' ? null : config.db.prismaClientPath @@ -64,7 +64,7 @@ export function getSystemPaths (cwd: string, config: KeystoneConfig | __Resolved } } -function getSudoGraphQLSchema (config: __ResolvedKeystoneConfig) { +function getSudoGraphQLSchema (config: ResolvedKeystoneConfig) { // This function creates a GraphQLSchema based on a modified version of the provided config. // The modifications are: // * All list level access control is disabled @@ -76,7 +76,7 @@ function getSudoGraphQLSchema (config: __ResolvedKeystoneConfig) { // operations that can be run. // // The resulting schema is used as the GraphQL schema when calling `context.sudo()`. - const transformedConfig: __ResolvedKeystoneConfig = { + const transformedConfig: ResolvedKeystoneConfig = { ...config, ui: { ...config.ui, @@ -183,7 +183,7 @@ function injectNewDefaults (prismaClient: unknown, lists: Record (x: T) { return x } -export function resolveDefaults (config: KeystoneConfig): __ResolvedKeystoneConfig { +export function resolveDefaults (config: KeystoneConfig, injectIdField = false): ResolvedKeystoneConfig { if (!['postgresql', 'sqlite', 'mysql'].includes(config.db.provider)) { throw new TypeError(`"db.provider" only supports "sqlite", "postgresql" or "mysql"`) } @@ -128,7 +128,7 @@ export function resolveDefaults (config: schemaPath: config.graphql?.schemaPath ?? 'schema.graphql', extendGraphqlSchema: config.graphql?.extendGraphqlSchema ?? ((s) => s), }, - lists: injectDefaults(config, defaultIdField), + lists: injectIdField ? injectDefaults(config, defaultIdField) : config.lists as ResolvedKeystoneConfig['lists'], server: { maxFileSize: 200 * 1024 * 1024, // 200 MiB extendExpressApp: config.server?.extendExpressApp ?? noop, diff --git a/packages/core/src/lib/typescript-schema-printer.ts b/packages/core/src/lib/typescript-schema-printer.ts index 2e7fc8d892a..9e6be3d115a 100644 --- a/packages/core/src/lib/typescript-schema-printer.ts +++ b/packages/core/src/lib/typescript-schema-printer.ts @@ -190,7 +190,7 @@ export function printGeneratedTypes ( })(), '}', `export type Context = import('@keystone-6/core/types').KeystoneContext>`, - `export type Config = import('@keystone-6/core/types').KeystoneConfig>`, + `export type Config = import('@keystone-6/core/types').ResolvedKeystoneConfig>`, '', 'export type TypeInfo = {', ` lists: {`, diff --git a/packages/core/src/schema.ts b/packages/core/src/schema.ts index 4d4fba24148..2117692bfbb 100644 --- a/packages/core/src/schema.ts +++ b/packages/core/src/schema.ts @@ -1,3 +1,4 @@ +import { resolveDefaults } from './lib/defaults' import { type BaseFields, type BaseKeystoneTypeInfo, @@ -7,7 +8,7 @@ import { } from './types' export function config (config: KeystoneConfig) { - return config + return resolveDefaults(config) } let i = 0 diff --git a/packages/core/src/scripts/dev.ts b/packages/core/src/scripts/dev.ts index 74c03b3c71f..078bb0c347c 100644 --- a/packages/core/src/scripts/dev.ts +++ b/packages/core/src/scripts/dev.ts @@ -25,7 +25,7 @@ import { generateTypes, getFormattedGraphQLSchema, } from '../artifacts' -import { type KeystoneConfig } from '../types' +import { type ResolvedKeystoneConfig } from '../types' import { printPrismaSchema } from '../lib/core/prisma-schema-printer' import { pkgDir } from '../pkg-dir' import { @@ -33,16 +33,14 @@ import { importBuiltKeystoneConfiguration, } from './utils' import { type Flags } from './cli' +import { noop } from '../lib/defaults' const devLoadingHTMLFilepath = path.join(pkgDir, 'static', 'dev-loading.html') -function stripExtendHttpServer (config: KeystoneConfig): KeystoneConfig { +function stripExtendHttpServer (config: ResolvedKeystoneConfig): ResolvedKeystoneConfig { const { server, ...rest } = config - if (server) { - const { extendHttpServer, ...restServer } = server - return { ...rest, server: restServer } - } - return rest + const { extendHttpServer, ...restServer } = server + return { ...rest, server: { ... restServer, extendHttpServer: noop } } } function resolvablePromise () { diff --git a/packages/core/src/types/config/index.ts b/packages/core/src/types/config/index.ts index 0e08f70241d..57a13afb198 100644 --- a/packages/core/src/types/config/index.ts +++ b/packages/core/src/types/config/index.ts @@ -251,7 +251,7 @@ export type KeystoneConfig = { +export type ResolvedKeystoneConfig = { types: KeystoneConfig['types'] db: Omit['db']>, 'enableLogging'> & { enableLogging: PrismaLogLevel | Array diff --git a/packages/core/src/types/next-fields.ts b/packages/core/src/types/next-fields.ts index f5153e42a3f..0c501a9ddf5 100644 --- a/packages/core/src/types/next-fields.ts +++ b/packages/core/src/types/next-fields.ts @@ -1,5 +1,5 @@ import Decimal from 'decimal.js' -import { graphql } from '..' +import { graphql } from './schema' import { type BaseListTypeInfo } from './type-info' import { type CommonFieldConfig } from './config' import { type DatabaseProvider } from './core' diff --git a/packages/core/src/types/utils.ts b/packages/core/src/types/utils.ts index 9146abdad4f..0df9b0b54f9 100644 --- a/packages/core/src/types/utils.ts +++ b/packages/core/src/types/utils.ts @@ -1,8 +1,6 @@ import pluralize from 'pluralize' import { humanize } from '../lib/utils' -import { - type __ResolvedKeystoneConfig -} from '../types' +import { type ResolvedKeystoneConfig } from '../types' export type JSONValue = | string @@ -62,7 +60,7 @@ const labelToPath = (str: string) => str.split(' ').join('-').toLowerCase() const labelToClass = (str: string) => str.replace(/\s+/g, '') // WARNING: may break in patch -export function __getNames (listKey: string, list: __ResolvedKeystoneConfig['lists'][string]) { +export function __getNames (listKey: string, list: ResolvedKeystoneConfig['lists'][string]) { const { graphql, ui, isSingleton } = list if (ui?.path !== undefined && !/^[a-z-_][a-z0-9-_]*$/.test(ui.path)) { throw new Error(`ui.path for ${listKey} is ${ui.path} but it must only contain lowercase letters, numbers, dashes, and underscores and not start with a number`) diff --git a/tests/api-tests/auth-header.test.ts b/tests/api-tests/auth-header.test.ts index 9b9cbd43a44..cd010e09e02 100644 --- a/tests/api-tests/auth-header.test.ts +++ b/tests/api-tests/auth-header.test.ts @@ -44,7 +44,7 @@ function setup (options?: any) { }), }, session: statelessSessions(), - }) + } as any) as any }) } @@ -114,7 +114,7 @@ describe('Auth testing', () => { }, session: statelessSessions(), - }), + } as any) as any, }) ).rejects.toMatchInlineSnapshot( `[Error: createAuth was called with an identityField of email on the list User but that field doesn't allow being searched uniquely with a String or ID. You should likely add \`isIndexed: 'unique'\` to the field at User.email]` diff --git a/tests/api-tests/auth.test.ts b/tests/api-tests/auth.test.ts index 4c1ab5f3a40..8ef9af061a2 100644 --- a/tests/api-tests/auth.test.ts +++ b/tests/api-tests/auth.test.ts @@ -57,7 +57,7 @@ const runner = setupTestRunner({ }), }, session: statelessSessions(), - }), + } as any) as any, }) async function authenticateWithPassword ( diff --git a/tests/api-tests/authed-user.test.ts b/tests/api-tests/authed-user.test.ts index d58f0602659..d267c2ac72b 100644 --- a/tests/api-tests/authed-user.test.ts +++ b/tests/api-tests/authed-user.test.ts @@ -29,7 +29,7 @@ const runner = setupTestRunner({ }), }, session: statelessSessions(), - })) + }) as any) as any }) test( diff --git a/tests/api-tests/field-groups.test.ts b/tests/api-tests/field-groups.test.ts index 1ee74812cb7..b0b2aa80c62 100644 --- a/tests/api-tests/field-groups.test.ts +++ b/tests/api-tests/field-groups.test.ts @@ -2,6 +2,7 @@ import { group, list } from '@keystone-6/core' import { allowAll } from '@keystone-6/core/access' import { getContext } from '@keystone-6/core/context' import { integer, text } from '@keystone-6/core/fields' +import { type ResolvedKeystoneConfig } from '@keystone-6/core/types' test('errors with nested field groups', () => { expect(() => @@ -29,7 +30,7 @@ test('errors with nested field groups', () => { }, }), }, - }, {}) + } as unknown as ResolvedKeystoneConfig, {}) ).toThrowErrorMatchingInlineSnapshot(`"groups cannot be nested"`) }) @@ -53,6 +54,6 @@ test('errors if you write a group manually differently to the group function', ( }, }), } - }, {}) + } as unknown as ResolvedKeystoneConfig, {}) ).toThrowErrorMatchingInlineSnapshot(`"unexpected value for a group at User.__group0"`) }) diff --git a/tests/api-tests/relationships/label-search-field-validation.test.ts b/tests/api-tests/relationships/label-search-field-validation.test.ts index 6123fa9aad9..cf2f0b3a1f9 100644 --- a/tests/api-tests/relationships/label-search-field-validation.test.ts +++ b/tests/api-tests/relationships/label-search-field-validation.test.ts @@ -2,6 +2,7 @@ import { list } from '@keystone-6/core' import { allowAll } from '@keystone-6/core/access' import { getContext } from '@keystone-6/core/context' import { integer, relationship, text } from '@keystone-6/core/fields' +import { type ResolvedKeystoneConfig } from '@keystone-6/core/types' const Thing = list({ access: allowAll, @@ -34,7 +35,7 @@ test("labelField that doesn't exist is rejected with displayMode: select", () => }), Thing, }, - }), + }) as unknown as ResolvedKeystoneConfig, {} as any ) ).toThrowErrorMatchingInlineSnapshot( @@ -66,7 +67,7 @@ test("labelField that doesn't exist is rejected with displayMode: cards", () => }), Thing, }, - }), + } as unknown as ResolvedKeystoneConfig), {} as any ) ).toThrowErrorMatchingInlineSnapshot( @@ -96,7 +97,7 @@ test("searchFields that don't exist are rejected with displayMode: select", () = }), Thing, }, - }), + } as unknown as ResolvedKeystoneConfig), {} as any ) ).toThrowErrorMatchingInlineSnapshot( @@ -128,7 +129,7 @@ test("searchFields that don't exist are rejected with displayMode: cards", () => }), Thing, }, - }), + } as unknown as ResolvedKeystoneConfig), {} as any ) ).toThrowErrorMatchingInlineSnapshot( @@ -158,7 +159,7 @@ test("searchFields that aren't searchable are rejected with displayMode: select" }), Thing, }, - }), + } as unknown as ResolvedKeystoneConfig), {} as any ) ).toThrowErrorMatchingInlineSnapshot( @@ -190,7 +191,7 @@ test("searchFields that aren't searchable are rejected with displayMode: cards", }), Thing, }, - }), + } as unknown as ResolvedKeystoneConfig), {} as any ) ).toThrowErrorMatchingInlineSnapshot( diff --git a/tests/cli-tests/__snapshots__/artifacts.test.ts.snap b/tests/cli-tests/__snapshots__/artifacts.test.ts.snap index eb69067fe4f..1a6e9217fb5 100644 --- a/tests/cli-tests/__snapshots__/artifacts.test.ts.snap +++ b/tests/cli-tests/__snapshots__/artifacts.test.ts.snap @@ -141,7 +141,7 @@ export declare namespace Lists { } } export type Context = import('@keystone-6/core/types').KeystoneContext> -export type Config = import('@keystone-6/core/types').KeystoneConfig> +export type Config = import('@keystone-6/core/types').ResolvedKeystoneConfig> export type TypeInfo = { lists: {