import { Injectable, Inject } from '@nestjs/common'; import { ListMasterExtension } from './list-master-extension.interface'; @Injectable() export class ListMasterEngine { private extensions = new Map(); constructor( @Inject('LIST_MASTER_EXTENSIONS') extensions: ListMasterExtension[], ) { extensions.forEach(ext => this.extensions.set(ext.name, ext)); } async execute(name: string, payload: any) { const ext = this.extensions.get(name) || this.extensions.get('GLOBAL'); if (!ext) throw new Error(`ListMaster extension not found: ${name}`); return ext.fetchDropdown({ type: name, ...payload }); } }