@@ -25,6 +25,14 @@ enum DockerEventType {
2525    CONTAINER  =  'container' , 
2626} 
2727
28+ interface  DockerEvent  { 
29+     Action ?: string ; 
30+     status ?: string ; 
31+     from ?: string ; 
32+     Type ?: string ; 
33+     [ key : string ] : unknown ; 
34+ } 
35+ 
2836@Injectable ( ) 
2937export  class  DockerEventService  implements  OnModuleDestroy ,  OnModuleInit  { 
3038    private  client : Docker ; 
@@ -96,18 +104,28 @@ export class DockerEventService implements OnModuleDestroy, OnModuleInit {
96104        } 
97105    } 
98106
99-     private  async  handleDockerEvent ( event : any ) : Promise < void >  { 
107+     private  async  handleDockerEvent ( event : unknown ) : Promise < void >  { 
108+         if  ( typeof  event  !==  'object'  ||  event  ===  null )  { 
109+             this . logger . error ( 'Received non-object event' ,  event ) ; 
110+             return ; 
111+         } 
112+ 
113+         // Type assertion to DockerEvent 
114+         const  dockerEvent  =  event  as  DockerEvent ; 
115+ 
100116        // Check if this is an action we're watching 
101-         const  actionName  =  event . Action  ||  event . status ; 
117+         const  actionName  =  dockerEvent . Action  ||  dockerEvent . status ; 
102118        const  shouldProcess  =  this . watchedActions . some ( 
103119            ( action )  =>  typeof  actionName  ===  'string'  &&  actionName . startsWith ( action ) 
104120        ) ; 
105121
106122        if  ( shouldProcess )  { 
107-             this . logger . debug ( `[${ event . from } ${ event . Type } ${ actionName }  ) ; 
123+             this . logger . debug ( `[${ dockerEvent . from } ${ dockerEvent . Type } ${ actionName }  ) ; 
108124
109125            // For container lifecycle events, update the container cache 
110-             if  ( event . Type  ===  DockerEventType . CONTAINER  &&  this . containerActions . includes ( actionName ) )  { 
126+             if  ( dockerEvent . Type  ===  DockerEventType . CONTAINER  &&  
127+                 typeof  actionName  ===  'string'  &&  
128+                 this . containerActions . includes ( actionName  as  DockerEventAction ) )  { 
111129                await  this . dockerService . debouncedContainerCacheUpdate ( ) ; 
112130            } 
113131        } 
0 commit comments