@@ -271,12 +271,10 @@ export class ObjectQL implements IDataEngine {
271271
272272 // 7. Recursively register nested plugins
273273 if ( Array . isArray ( manifest . plugins ) && manifest . plugins . length > 0 ) {
274- console . log ( `[ObjectQL] Processing ${ manifest . plugins . length } nested plugins from ${ id } ` ) ;
275274 this . logger . debug ( 'Processing nested plugins' , { id, count : manifest . plugins . length } ) ;
276275 for ( const plugin of manifest . plugins ) {
277276 if ( plugin && typeof plugin === 'object' ) {
278277 const pluginName = plugin . name || plugin . id || 'unnamed-plugin' ;
279- console . log ( `[ObjectQL] Registering nested plugin: ${ pluginName } , has objects: ${ ! ! plugin . objects } , objects type: ${ typeof plugin . objects } ` ) ;
280278 this . logger . debug ( 'Registering nested plugin' , { pluginName, parentId : id } ) ;
281279 this . registerPlugin ( plugin , id , namespace ) ;
282280 }
@@ -296,41 +294,44 @@ export class ObjectQL implements IDataEngine {
296294 * @param parentNamespace - The parent package's namespace (for FQN resolution)
297295 */
298296 private registerPlugin ( plugin : any , parentId : string , parentNamespace ?: string ) {
299- const pluginId = plugin . id || plugin . name || parentId ;
297+ const pluginName = plugin . name || plugin . id || 'unnamed' ;
300298 const pluginNamespace = plugin . namespace || parentNamespace ;
301299
300+ // Use parentId as the owning package for namespace consistency.
301+ // The parent package already claimed the namespace — nested plugins
302+ // contribute objects UNDER the parent's ownership.
303+ const ownerId = parentId ;
304+
302305 // Register objects (supports both Array and Map formats)
303306 if ( plugin . objects ) {
304307 try {
305308 if ( Array . isArray ( plugin . objects ) ) {
306- console . log ( `[ObjectQL] Registering ${ plugin . objects . length } objects (Array) for plugin ${ pluginId } ` ) ;
309+ this . logger . debug ( ' Registering plugin objects (Array)' , { pluginName , count : plugin . objects . length } ) ;
307310 for ( const objDef of plugin . objects ) {
308- const fqn = SchemaRegistry . registerObject ( objDef , pluginId , pluginNamespace , 'own' ) ;
309- console . log ( `[ObjectQL] Registered Object: ${ fqn } ` ) ;
311+ const fqn = SchemaRegistry . registerObject ( objDef , ownerId , pluginNamespace , 'own' ) ;
312+ this . logger . debug ( ' Registered Object' , { fqn, from : pluginName } ) ;
310313 }
311314 } else {
312315 const entries = Object . entries ( plugin . objects ) ;
313- console . log ( `[ObjectQL] Registering ${ entries . length } objects (Map) for plugin ${ pluginId } , namespace: ${ pluginNamespace } ` ) ;
316+ this . logger . debug ( ' Registering plugin objects (Map)' , { pluginName , count : entries . length } ) ;
314317 for ( const [ name , objDef ] of entries ) {
315318 ( objDef as any ) . name = name ;
316- const fqn = SchemaRegistry . registerObject ( objDef as any , pluginId , pluginNamespace , 'own' ) ;
317- console . log ( `[ObjectQL] Registered Object: ${ fqn } ` ) ;
319+ const fqn = SchemaRegistry . registerObject ( objDef as any , ownerId , pluginNamespace , 'own' ) ;
320+ this . logger . debug ( ' Registered Object' , { fqn, from : pluginName } ) ;
318321 }
319322 }
320323 } catch ( err : any ) {
321- console . error ( `[ObjectQL] Failed to register plugin objects for ${ pluginId } :` , err . message ) ;
324+ this . logger . warn ( ' Failed to register plugin objects' , { pluginName , error : err . message } ) ;
322325 }
323- } else {
324- console . log ( `[ObjectQL] Plugin ${ pluginId } has no objects` ) ;
325326 }
326327
327328 // Register plugin as app if it has navigation (for sidebar display)
328329 if ( plugin . name && plugin . navigation ) {
329330 try {
330- SchemaRegistry . registerApp ( plugin , pluginId ) ;
331- this . logger . debug ( 'Registered plugin-as-app' , { app : plugin . name , from : pluginId } ) ;
331+ SchemaRegistry . registerApp ( plugin , ownerId ) ;
332+ this . logger . debug ( 'Registered plugin-as-app' , { app : plugin . name , from : pluginName } ) ;
332333 } catch ( err : any ) {
333- this . logger . warn ( 'Failed to register plugin as app' , { pluginId , error : err . message } ) ;
334+ this . logger . warn ( 'Failed to register plugin as app' , { pluginName , error : err . message } ) ;
334335 }
335336 }
336337
@@ -348,7 +349,7 @@ export class ObjectQL implements IDataEngine {
348349 for ( const item of items ) {
349350 const itemName = item . name || item . id ;
350351 if ( itemName ) {
351- SchemaRegistry . registerItem ( key , item , 'name' as any , pluginId ) ;
352+ SchemaRegistry . registerItem ( key , item , 'name' as any , ownerId ) ;
352353 }
353354 }
354355 }
0 commit comments