@@ -185,19 +185,22 @@ export class ObjectStackProtocolImplementation implements ObjectStackProtocol {
185185 } ;
186186 }
187187
188- async getMetaItems ( request : { type : string } ) {
189- let items = SchemaRegistry . listItems ( request . type ) ;
188+ async getMetaItems ( request : { type : string ; packageId ?: string } ) {
189+ const { packageId } = request ;
190+ let items = SchemaRegistry . listItems ( request . type , packageId ) ;
190191 // Normalize singular/plural: REST uses singular ('app') but registry may store as plural ('apps')
191192 if ( items . length === 0 ) {
192193 const alt = request . type . endsWith ( 's' ) ? request . type . slice ( 0 , - 1 ) : request . type + 's' ;
193- items = SchemaRegistry . listItems ( alt ) ;
194+ items = SchemaRegistry . listItems ( alt , packageId ) ;
194195 }
195196
196197 // Fallback to database if registry is empty for this type
197198 if ( items . length === 0 ) {
198199 try {
200+ const whereClause : any = { type : request . type , state : 'active' } ;
201+ if ( packageId ) whereClause . _packageId = packageId ;
199202 const allRecords = await this . engine . find ( 'sys_metadata' , {
200- where : { type : request . type , state : 'active' }
203+ where : whereClause
201204 } ) ;
202205 if ( allRecords && allRecords . length > 0 ) {
203206 items = allRecords . map ( ( record : any ) => {
@@ -235,7 +238,7 @@ export class ObjectStackProtocolImplementation implements ObjectStackProtocol {
235238 } ;
236239 }
237240
238- async getMetaItem ( request : { type : string , name : string } ) {
241+ async getMetaItem ( request : { type : string , name : string , packageId ?: string } ) {
239242 let item = SchemaRegistry . getItem ( request . type , request . name ) ;
240243 // Normalize singular/plural
241244 if ( item === undefined ) {
0 commit comments