/** * @angular-modernizer/plugin-angular - Promise Component to Reactive Transform Rule * * Thin rule wrapper. All logic in PromiseComponentTransformOrchestrator. */ import type { TransformRule, TransformContext, TransformResult, } from '@angular-modernizer/plugin-system'; import type { PublicApi } from '@angular-modernizer/api'; import { PromiseComponentTransformOrchestrator } from '../orchestrators/promise-component-transform.orchestrator.js'; export class PromiseComponentTransformRule implements TransformRule { public readonly id = 'angular:promise-component-to-reactive'; public readonly name = 'Promise Component to Reactive Transform'; public readonly description = 'Transforms async @Component methods to Observable properties, removing manual change detection calls'; public readonly category = 'refactoring'; public readonly tags = [ 'angular', 'rxjs', 'observable', 'promise', 'component', 'async-pipe', ]; private readonly orchestrator = new PromiseComponentTransformOrchestrator(); async transform( context: TransformContext, ): Promise { const pluginConfig = context.config[ '@angular-modernizer/plugin-angular' ] as Record | undefined; if ( pluginConfig?.['transformationType'] !== 'promise-component-to-reactive' ) { return { ruleId: this.id, modified: false, message: 'Transformation type not applicable', filePath: context.filePath, }; } return this.orchestrator.run(context); } }