@@ -41,15 +41,14 @@ import * as BuiltinFunctions from './functions';
4141import { SchemaDbPusher } from './helpers/schema-db-pusher' ;
4242import type { ClientOptions , ProceduresOptions } from './options' ;
4343import type { AnyPlugin } from './plugin' ;
44+ import { createZenStackPromise , type ZenStackPromise } from './promise' ;
45+ import { fieldHasDefaultValue , getField , isUnsupportedField , requireModel } from './query-utils' ;
46+ import { ResultProcessor } from './result-processor' ;
4447
4548type ExtResultFieldDef = {
4649 needs : Record < string , true > ;
4750 compute : ( data : Record < string , any > ) => unknown ;
4851} ;
49- import { getField } from './query-utils' ;
50- import { createZenStackPromise , type ZenStackPromise } from './promise' ;
51- import { fieldHasDefaultValue , isUnsupportedField , requireModel } from './query-utils' ;
52- import { ResultProcessor } from './result-processor' ;
5352
5453/**
5554 * ZenStack ORM client.
@@ -172,7 +171,8 @@ export class ClientImpl {
172171 if ( modelDef . computedFields ) {
173172 for ( const fieldName of Object . keys ( modelDef . computedFields ) ) {
174173 // check both uncapitalized (current) and original (backward compat) model name
175- const modelConfig = computedFieldsConfig ?. [ lowerCaseFirst ( modelName ) ] ?? computedFieldsConfig ?. [ modelName ] ;
174+ const modelConfig =
175+ computedFieldsConfig ?. [ lowerCaseFirst ( modelName ) ] ?? computedFieldsConfig ?. [ modelName ] ;
176176 const fieldConfig = modelConfig ?. [ fieldName ] ;
177177 // Check if the computed field has a configuration
178178 if ( fieldConfig === null || fieldConfig === undefined ) {
@@ -426,7 +426,7 @@ export class ClientImpl {
426426 }
427427
428428 $setAuth ( auth : AuthType < SchemaDef > | undefined ) {
429- if ( auth !== undefined && typeof auth !== 'object' ) {
429+ if ( auth !== undefined && ( typeof auth !== 'object' || auth === null || Array . isArray ( auth ) ) ) {
430430 throw new Error ( 'Invalid auth object' ) ;
431431 }
432432 const newClient = new ClientImpl ( this . schema , this . $options , this ) ;
0 commit comments