Skip to content

Commit a0740f4

Browse files
committed
fix test due to injected id field
1 parent 249f1b1 commit a0740f4

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

packages/core/src/lib/createSystem.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ function formatUrl (provider: ResolvedKeystoneConfig['db']['provider'], url: str
201201
}
202202

203203
export function createSystem (config_: KeystoneConfig | ResolvedKeystoneConfig) {
204-
const config = resolveDefaults(config_ as KeystoneConfig)
204+
const config = resolveDefaults(config_ as KeystoneConfig, true)
205205
const lists = initialiseLists(config)
206206
const adminMeta = createAdminMeta(config, lists)
207207
const graphQLSchema = createGraphQLSchema(config, lists, adminMeta, false)

packages/core/src/lib/defaults.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function defaultIsAccessAllowed ({ session, sessionStrategy }: KeystoneContext)
7676
export async function noop () {}
7777
function identity<T> (x: T) { return x }
7878

79-
export function resolveDefaults<TypeInfo extends BaseKeystoneTypeInfo> (config: KeystoneConfig<TypeInfo>): ResolvedKeystoneConfig<TypeInfo> {
79+
export function resolveDefaults<TypeInfo extends BaseKeystoneTypeInfo> (config: KeystoneConfig<TypeInfo>, injectIdField = false): ResolvedKeystoneConfig<TypeInfo> {
8080
if (!['postgresql', 'sqlite', 'mysql'].includes(config.db.provider)) {
8181
throw new TypeError(`"db.provider" only supports "sqlite", "postgresql" or "mysql"`)
8282
}
@@ -126,7 +126,7 @@ export function resolveDefaults<TypeInfo extends BaseKeystoneTypeInfo> (config:
126126
schemaPath: config.graphql?.schemaPath ?? 'schema.graphql',
127127
extendGraphqlSchema: config.graphql?.extendGraphqlSchema ?? ((s) => s),
128128
},
129-
lists: injectDefaults(config, defaultIdField),
129+
lists: injectIdField ? injectDefaults(config, defaultIdField) : config.lists,
130130
server: {
131131
maxFileSize: 200 * 1024 * 1024, // 200 MiB
132132
extendExpressApp: config.server?.extendExpressApp ?? noop,

packages/core/src/types/next-fields.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Decimal from 'decimal.js'
2-
import { graphql } from '..'
2+
import { graphql } from './schema'
33
import { type BaseListTypeInfo } from './type-info'
44
import { type CommonFieldConfig } from './config'
55
import { type DatabaseProvider } from './core'

tests/cli-tests/__snapshots__/artifacts.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export declare namespace Lists {
151151
}
152152
}
153153
export type Context<Session = any> = import('@keystone-6/core/types').KeystoneContext<TypeInfo<Session>>
154-
export type Config<Session = any> = import('@keystone-6/core/types').KeystoneConfig<TypeInfo<Session>>
154+
export type Config<Session = any> = import('@keystone-6/core/types').ResolvedKeystoneConfig<TypeInfo<Session>>
155155
156156
export type TypeInfo<Session = any> = {
157157
lists: {

0 commit comments

Comments
 (0)