@@ -4,7 +4,7 @@ import { Project } from '../entities/project.js';
44import { ResourceConfig } from '../entities/resource-config.js' ;
55import { ResourceInfo } from '../entities/resource-info.js' ;
66import { ProcessName , SubProcessName , ctx } from '../events/context.js' ;
7- import { DependencyMap , PluginManager } from '../plugins/plugin-manager.js' ;
7+ import { PluginManager , ResourceDefinitionMap } from '../plugins/plugin-manager.js' ;
88import { PromptType , Reporter } from '../ui/reporters/reporter.js' ;
99import { wildCardMatch } from '../utils/wild-card-match.js' ;
1010
@@ -68,11 +68,11 @@ Open a new terminal or source '.zshrc' for the new changes to be reflected`);
6868 reporter : Reporter ,
6969 initializeResult : InitializationResult
7070 ) : Promise < { plan : Plan , destroyProject : Project } > {
71- const { project, pluginManager, typeIdsToDependenciesMap } = initializeResult ;
71+ const { project, pluginManager, resourceDefinitions } = initializeResult ;
7272
7373 // TODO: In the future if a user supplies resourceId.name (naming a specific resource) destroy that resource instead of stripping the name out.
74- const matchedTypes = this . matchTypeIds ( typeIds . map ( ( id ) => id . split ( '.' ) . at ( 0 ) ?? '' ) , [ ...typeIdsToDependenciesMap . keys ( ) ] )
75- await DestroyOrchestrator . validateTypeIds ( matchedTypes , project , pluginManager , typeIdsToDependenciesMap ) ;
74+ const matchedTypes = this . matchTypeIds ( typeIds . map ( ( id ) => id . split ( '.' ) . at ( 0 ) ?? '' ) , [ ...resourceDefinitions . keys ( ) ] )
75+ await DestroyOrchestrator . validateTypeIds ( matchedTypes , project , pluginManager , resourceDefinitions ) ;
7676
7777 const resourceInfoList = ( await pluginManager . getMultipleResourceInfo ( matchedTypes ) ) ;
7878 const resourcesToDestroy = await DestroyOrchestrator . getDestroyParameters ( reporter , project , resourceInfoList ) ;
@@ -83,7 +83,7 @@ Open a new terminal or source '.zshrc' for the new changes to be reflected`);
8383 project . codifyFiles
8484 ) . toDestroyProject ( ) ;
8585
86- destroyProject . resolveDependenciesAndCalculateEvalOrder ( typeIdsToDependenciesMap ) ;
86+ destroyProject . resolveDependenciesAndCalculateEvalOrder ( resourceDefinitions ) ;
8787 const plan = await ctx . subprocess ( ProcessName . PLAN , ( ) =>
8888 pluginManager . plan ( destroyProject )
8989 )
@@ -96,16 +96,16 @@ Open a new terminal or source '.zshrc' for the new changes to be reflected`);
9696 reporter : Reporter ,
9797 initializeResult : InitializationResult
9898 ) : Promise < { plan : Plan , destroyProject : Project } > {
99- const { pluginManager, project, typeIdsToDependenciesMap } = initializeResult ;
99+ const { pluginManager, project, resourceDefinitions } = initializeResult ;
100100
101101 await ctx . subprocess ( SubProcessName . VALIDATE , async ( ) => {
102- project . validateTypeIds ( typeIdsToDependenciesMap ) ;
102+ project . validateTypeIds ( resourceDefinitions ) ;
103103 const validationResults = await pluginManager . validate ( project ) ;
104104 project . handlePluginResourceValidationResults ( validationResults ) ;
105105 } )
106106
107107 const destroyProject = project . toDestroyProject ( ) ;
108- destroyProject . resolveDependenciesAndCalculateEvalOrder ( typeIdsToDependenciesMap ) ;
108+ destroyProject . resolveDependenciesAndCalculateEvalOrder ( resourceDefinitions ) ;
109109
110110 const plan = await ctx . subprocess ( ProcessName . PLAN , ( ) =>
111111 pluginManager . plan ( destroyProject )
@@ -147,10 +147,10 @@ ${JSON.stringify(unsupportedTypeIds)}`);
147147 return result ;
148148 }
149149
150- private static async validateTypeIds ( typeIds : string [ ] , project : Project , pluginManager : PluginManager , dependencyMap : DependencyMap ) : Promise < void > {
151- project . validateTypeIds ( dependencyMap ) ;
150+ private static async validateTypeIds ( typeIds : string [ ] , project : Project , pluginManager : PluginManager , resourceDefinitions : ResourceDefinitionMap ) : Promise < void > {
151+ project . validateTypeIds ( resourceDefinitions ) ;
152152
153- const unsupportedTypeIds = typeIds . filter ( ( type ) => ! dependencyMap . has ( type ) ) ;
153+ const unsupportedTypeIds = typeIds . filter ( ( type ) => ! resourceDefinitions . has ( type ) ) ;
154154 if ( unsupportedTypeIds . length > 0 ) {
155155 throw new Error ( `The following resources cannot be destroyed. No plugins found that support the following types:
156156${ JSON . stringify ( unsupportedTypeIds ) } `) ;
0 commit comments