/** * @angular-modernizer/plugin-angular - Subscription Transform Orchestrator * * Core transformation logic for fixing raw .subscribe() calls in lifecycle hooks. * Converts them to managed subscriptions using takeUntilDestroyed(). */ import type { TransformContext, TransformResult } from '@angular-modernizer/plugin-system'; import type { PublicApi } from '@angular-modernizer/api'; /** * Subscription Transform Orchestrator * * Three guarantees: * 1. **Idempotent** — skips hooks that already have takeUntilDestroyed, and * detects existing DestroyRef fields before adding a new one. * 2. **Atomic** — on any error, the original source text is restored. * 3. **Reversible** — original text is stored in metadata for rollback. */ export declare class SubscriptionTransformOrchestrator { readonly ruleId = "angular:subscription-transform"; run(context: TransformContext): TransformResult; private findComponent; /** * Find lifecycle hooks that have .subscribe() calls but NOT takeUntilDestroyed. * Hooks that already use takeUntilDestroyed are already correct — skip them. */ private findViolatingLifecycleHooks; /** * Ensure the class has a DestroyRef field for use with takeUntilDestroyed. * Returns the field name to reference in the method body. * * Priority: * 1. Existing inject(DestroyRef) field → reuse * 2. Existing constructor param typed DestroyRef → reuse * 3. Neither → insert `private readonly destroyRef = inject(DestroyRef);` */ private ensureDestroyRefField; /** * Find an existing DestroyRef field: * - inject() style: `private x = inject(DestroyRef);` * - Constructor param: `constructor(private x: DestroyRef) {}` */ private findExistingDestroyRefField; /** * Ensure required imports are present: * - `inject` and `DestroyRef` from `@angular/core` * - `takeUntilDestroyed` from `@angular/core/rxjs-interop` */ private ensureImports; /** * Add named imports to a module specifier if not already present. * Creates a new import declaration if the module is not yet imported. */ private ensureNamedImports; } //# sourceMappingURL=subscription-transform.orchestrator.d.ts.map