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 29, 2024
1 parent 249f1b1 commit 46f79c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 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

0 comments on commit 46f79c2

Please sign in to comment.