@@ -13,6 +13,8 @@ import type { InitialisedList } from './core/initialise-lists'
1313
1414const introspectionTypesSet = new Set ( introspectionTypes )
1515
16+ // note this is the types for scalars as _input_ types
17+ // and before scalar parsing
1618const SCALARS = {
1719 ID : 'string' ,
1820 Boolean : 'boolean' ,
@@ -21,6 +23,7 @@ const SCALARS = {
2123 Float : 'number' ,
2224 JSON : `import('@keystone-6/core/types').JSONValue` ,
2325 Decimal : `import('@keystone-6/core/types').Decimal | string` ,
26+ Empty : `{}` ,
2427} as const
2528
2629function stringify ( x : string ) {
@@ -143,21 +146,15 @@ export function printGeneratedTypes (
143146 // Resolved* types
144147 ...( function * ( ) {
145148 for ( const list of Object . values ( lists ) ) {
146- if ( list . graphql . isEnabled . create ) yield printInterimType ( prismaClientPath , list , 'create' )
147- if ( list . graphql . isEnabled . update ) yield printInterimType ( prismaClientPath , list , 'update' )
149+ yield printInterimType ( prismaClientPath , list , 'create' )
150+ yield printInterimType ( prismaClientPath , list , 'update' )
148151 }
149152 } ( ) ) ,
150153 '' ,
151154 'export declare namespace Lists {' ,
152155 ...( function * ( ) {
153156 for ( const [ listKey , list ] of Object . entries ( lists ) ) {
154- const {
155- whereInputName,
156- whereUniqueInputName,
157- createInputName,
158- updateInputName,
159- listOrderName,
160- } = list . prisma . types
157+ const { createInputName, updateInputName } = list . prisma . types
161158 const listTypeInfoName = `Lists.${ listKey } .TypeInfo`
162159
163160 yield [
@@ -170,15 +167,15 @@ export function printGeneratedTypes (
170167 ` fields: ${ Object . keys ( list . fields ) . map ( x => `'${ x } '` ) . join ( ' | ' ) } ` ,
171168 ` item: Item` ,
172169 ` inputs: {` ,
173- ` where: ${ list . graphql . isEnabled . query ? whereInputName : 'never' } ` ,
174- ` uniqueWhere: ${ list . graphql . isEnabled . query ? whereUniqueInputName : 'never' } ` ,
175- ` create: ${ list . graphql . isEnabled . create ? list . graphql . names . createInputName : 'never' } ` ,
176- ` update: ${ list . graphql . isEnabled . update ? list . graphql . names . updateInputName : 'never' } ` ,
177- ` orderBy: ${ list . graphql . isEnabled . query ? listOrderName : 'never' } ` ,
170+ ` where: ${ printTypeReferenceWithoutNullable ( list . graphql . types . where . graphQLType ) } ` ,
171+ ` uniqueWhere: ${ printTypeReferenceWithoutNullable ( list . graphql . types . uniqueWhere . graphQLType ) } ` ,
172+ ` create: ${ printTypeReferenceWithoutNullable ( list . graphql . types . create . graphQLType ) } ` ,
173+ ` update: ${ printTypeReferenceWithoutNullable ( list . graphql . types . update . graphQLType ) } ` ,
174+ ` orderBy: ${ printTypeReferenceWithoutNullable ( list . graphql . types . orderBy . graphQLType ) } ` ,
178175 ` }` ,
179176 ` prisma: {` ,
180- ` create: ${ list . graphql . isEnabled . create ? ` Resolved${ createInputName } ` : 'never' } ` ,
181- ` update: ${ list . graphql . isEnabled . update ? ` Resolved${ updateInputName } ` : 'never' } ` ,
177+ ` create: Resolved${ createInputName } ` ,
178+ ` update: Resolved${ updateInputName } ` ,
182179 ` }` ,
183180 ` all: __TypeInfo<Session>` ,
184181 ` }` ,
0 commit comments