Skip to content

Commit

Permalink
fix test due to injected id field
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamsi committed Jun 30, 2024
1 parent 249f1b1 commit a0740f4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/lib/createSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function formatUrl (provider: ResolvedKeystoneConfig['db']['provider'], url: str
}

export function createSystem (config_: KeystoneConfig | ResolvedKeystoneConfig) {
const config = resolveDefaults(config_ as KeystoneConfig)
const config = resolveDefaults(config_ as KeystoneConfig, true)
const lists = initialiseLists(config)
const adminMeta = createAdminMeta(config, lists)
const graphQLSchema = createGraphQLSchema(config, lists, adminMeta, false)
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function defaultIsAccessAllowed ({ session, sessionStrategy }: KeystoneContext)
export async function noop () {}
function identity<T> (x: T) { return x }

export function resolveDefaults<TypeInfo extends BaseKeystoneTypeInfo> (config: KeystoneConfig<TypeInfo>): ResolvedKeystoneConfig<TypeInfo> {
export function resolveDefaults<TypeInfo extends BaseKeystoneTypeInfo> (config: KeystoneConfig<TypeInfo>, injectIdField = false): ResolvedKeystoneConfig<TypeInfo> {
if (!['postgresql', 'sqlite', 'mysql'].includes(config.db.provider)) {
throw new TypeError(`"db.provider" only supports "sqlite", "postgresql" or "mysql"`)
}
Expand Down Expand Up @@ -126,7 +126,7 @@ export function resolveDefaults<TypeInfo extends BaseKeystoneTypeInfo> (config:
schemaPath: config.graphql?.schemaPath ?? 'schema.graphql',
extendGraphqlSchema: config.graphql?.extendGraphqlSchema ?? ((s) => s),
},
lists: injectDefaults(config, defaultIdField),
lists: injectIdField ? injectDefaults(config, defaultIdField) : config.lists,
server: {
maxFileSize: 200 * 1024 * 1024, // 200 MiB
extendExpressApp: config.server?.extendExpressApp ?? noop,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/types/next-fields.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion tests/cli-tests/__snapshots__/artifacts.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export declare namespace Lists {
}
}
export type Context<Session = any> = import('@keystone-6/core/types').KeystoneContext<TypeInfo<Session>>
export type Config<Session = any> = import('@keystone-6/core/types').KeystoneConfig<TypeInfo<Session>>
export type Config<Session = any> = import('@keystone-6/core/types').ResolvedKeystoneConfig<TypeInfo<Session>>
export type TypeInfo<Session = any> = {
lists: {
Expand Down

0 comments on commit a0740f4

Please sign in to comment.