@@ -101,22 +101,26 @@ export class ObjectQL implements IObjectQL {
101101
102102 on ( event : HookName , objectName : string , handler : HookHandler , packageName ?: string ) {
103103 // Delegate to kernel hook manager
104- this . kernel . hooks . register ( event , objectName , handler , packageName ) ;
104+ // Note: Type casting needed due to type incompatibility between ObjectQL HookName (includes beforeCount)
105+ // and runtime HookName. This is safe as the kernel will accept all hook types.
106+ this . kernel . hooks . register ( event as any , objectName , handler as any , packageName ) ;
105107 }
106108
107109 async triggerHook ( event : HookName , objectName : string , ctx : HookContext ) {
108110 // Delegate to kernel hook manager
109- await this . kernel . hooks . trigger ( event , objectName , ctx ) ;
111+ await this . kernel . hooks . trigger ( event as any , objectName , ctx as any ) ;
110112 }
111113
112114 registerAction ( objectName : string , actionName : string , handler : ActionHandler , packageName ?: string ) {
113115 // Delegate to kernel action manager
114- this . kernel . actions . register ( objectName , actionName , handler , packageName ) ;
116+ // Note: Type casting needed due to type incompatibility between ObjectQL ActionHandler
117+ // (includes input/api fields) and runtime ActionHandler. This is safe as runtime is more permissive.
118+ this . kernel . actions . register ( objectName , actionName , handler as any , packageName ) ;
115119 }
116120
117121 async executeAction ( objectName : string , actionName : string , ctx : ActionContext ) {
118122 // Delegate to kernel action manager
119- return await this . kernel . actions . execute ( objectName , actionName , ctx ) ;
123+ return await this . kernel . actions . execute ( objectName , actionName , ctx as any ) ;
120124 }
121125
122126 createContext ( options : ObjectQLContextOptions ) : ObjectQLContext {
@@ -128,7 +132,7 @@ export class ObjectQL implements IObjectQL {
128132 object : ( name : string ) => {
129133 return new ObjectRepository ( name , ctx , this ) ;
130134 } ,
131- transaction : async ( callback ) => {
135+ transaction : async ( callback : ( ctx : ObjectQLContext ) => Promise < any > ) => {
132136 const driver = this . datasources [ 'default' ] ;
133137 if ( ! driver || ! driver . beginTransaction ) {
134138 return callback ( ctx ) ;
@@ -144,7 +148,7 @@ export class ObjectQL implements IObjectQL {
144148 const trxCtx : ObjectQLContext = {
145149 ...ctx ,
146150 transactionHandle : trx ,
147- transaction : async ( cb ) => cb ( trxCtx )
151+ transaction : async ( cb : ( ctx : ObjectQLContext ) => Promise < any > ) => cb ( trxCtx )
148152 } ;
149153
150154 try {
@@ -183,7 +187,7 @@ export class ObjectQL implements IObjectQL {
183187 // Normalize fields
184188 if ( object . fields ) {
185189 for ( const [ key , field ] of Object . entries ( object . fields ) ) {
186- if ( ! field . name ) {
190+ if ( field && ! field . name ) {
187191 field . name = key ;
188192 }
189193 }
0 commit comments