@@ -55,14 +55,29 @@ export class MetadataPlugin implements Plugin {
5555 if ( items . length > 0 ) {
5656 ctx . logger . info ( `Loaded ${ items . length } ${ type } ` ) ;
5757
58- // Helper: Register with ObjectQL if it is an Object
59- if ( type === 'objects' ) {
60- const ql = ctx . getService ( 'objectql' ) ;
61- if ( ql && ql . registry && typeof ql . registry . registerObject === 'function' ) {
62- items . forEach ( ( obj : any ) => {
63- ql . registry . registerObject ( obj . name , obj ) ;
64- } ) ;
65- }
58+ // Helper: Register with ObjectQL Registry
59+ const ql = ctx . getService ( 'objectql' ) ;
60+ if ( ql && ql . registry ) {
61+ items . forEach ( ( item : any ) => {
62+ // Determine key field (id or name)
63+ const keyField = item . id ? 'id' : 'name' ;
64+
65+ // Map plural type to singular/registry type if needed
66+ // For now, we use the singular form for standard types:
67+ // objects -> object, apps -> app, etc.
68+ // But Registry seems to accept arbitrary strings.
69+ // To match Protocol standard, we might want to normalize.
70+ // Let's use the directory name (plural) as the type for now,
71+ // OR map 'objects' -> 'object' specifically.
72+
73+ let registryType = type ;
74+ if ( type === 'objects' ) registryType = 'object' ;
75+ if ( type === 'apps' ) registryType = 'app' ;
76+ if ( type === 'plugins' ) registryType = 'plugin' ;
77+ if ( type === 'functions' ) registryType = 'function' ;
78+
79+ ql . registry . registerItem ( registryType , item , keyField ) ;
80+ } ) ;
6681 }
6782 }
6883 } catch ( e : any ) {
0 commit comments