@@ -13,6 +13,7 @@ import { printSchemaWithDirectives } from '@graphql-tools/utils'
1313import { consola } from 'consola'
1414import { defu } from 'defu'
1515import { parse } from 'graphql'
16+ import { CurrencyResolver , DateTimeISOResolver , DateTimeResolver , JSONObjectResolver , JSONResolver , NonEmptyStringResolver , UUIDResolver } from 'graphql-scalars'
1617
1718/**
1819 * Type definition pointer for GraphQL schemas
@@ -111,42 +112,35 @@ export async function generateClientTypes(
111112
112113 consola . info ( `[graphql] Found ${ docs . length } client GraphQL documents` )
113114
114- const defaultConfig : CodegenClientConfig = {
115+ const defaultConfig : CodegenClientConfig | GenericSdkConfig = {
115116 emitLegacyCommonJSImports : false ,
116117 useTypeImports : true ,
117118 enumsAsTypes : true ,
118119 strictScalars : true ,
119120 maybeValue : 'T | null | undefined' ,
120121 inputMaybeValue : 'T | undefined' ,
121- scalars : {
122- DateTime : 'string' ,
123- JSON : 'any' ,
124- UUID : 'string' ,
125- NonEmptyString : 'string' ,
126- Currency : 'string' ,
127- } ,
128- }
129-
130- const mergedConfig = defu ( defaultConfig , config )
131-
132- const defaultSdkConfig : GenericSdkConfig = {
133122 documentMode : 'string' ,
134123 pureMagicComment : true ,
135- strictScalars : true ,
136- useTypeImports : true ,
137124 dedupeOperationSuffix : true ,
138125 rawRequest : true ,
139-
140126 scalars : {
141- DateTime : 'Date' ,
142- JSON : 'any' ,
143- UUID : 'string' ,
144- NonEmptyString : 'string' ,
145- Currency : 'string' ,
127+ DateTime : DateTimeResolver . extensions . codegenScalarType as any ,
128+ DateTimeISO : DateTimeISOResolver . extensions . codegenScalarType as any ,
129+ UUID : UUIDResolver . extensions . codegenScalarType as any ,
130+ JSON : JSONResolver . extensions . codegenScalarType as any ,
131+ JSONObject : JSONObjectResolver . extensions . codegenScalarType as any ,
132+ NonEmptyString : NonEmptyStringResolver . extensions . codegenScalarType as any ,
133+ Currency : CurrencyResolver . extensions . codegenScalarType as any ,
134+ File : {
135+ input : 'File' ,
136+ output : 'File' ,
137+ } ,
146138 } ,
147139 }
148140
149- const mergedSdkConfig = defu ( defaultSdkConfig , sdkConfig )
141+ const mergedConfig = defu ( defaultConfig , config )
142+
143+ const mergedSdkConfig = defu ( mergedConfig , sdkConfig )
150144
151145 try {
152146 const output = await codegen ( {
0 commit comments