88import { InternalError } from '../common/errors.js' ;
99import { Plan , ResourcePlan } from '../entities/plan.js' ;
1010import { Project } from '../entities/project.js' ;
11- import { ResourceConfig } from '../entities/resource-config.js' ;
1211import { SubProcessName , ctx } from '../events/context.js' ;
12+ import { RequiredParameter , RequiredParameters } from '../orchestrators/import.js' ;
1313import { groupBy } from '../utils/index.js' ;
1414import { Plugin } from './plugin.js' ;
1515import { PluginResolver } from './resolver.js' ;
@@ -66,7 +66,7 @@ export class PluginManager {
6666
6767 return plugin . getResourceInfo ( type ) ;
6868 }
69-
69+
7070 async importResource ( config : ResourceJson ) : Promise < ImportResponseData > {
7171 const pluginName = this . resourceToPluginMapping . get ( config . core . type ) ;
7272 if ( ! pluginName ) {
@@ -81,7 +81,7 @@ export class PluginManager {
8181 return plugin . import ( config ) ;
8282 }
8383
84- async getPlan ( project : Project ) : Promise < Plan > {
84+ async plan ( project : Project ) : Promise < Plan > {
8585 const result = new Array < ResourcePlan > ( ) ;
8686 await Promise . all (
8787 project . evaluationOrder ! . map ( async ( id ) => {
@@ -122,6 +122,41 @@ export class PluginManager {
122122 }
123123 }
124124
125+ async getRequiredParameters (
126+ typeIds : string [ ] ,
127+ ) : Promise < RequiredParameters > {
128+ const allRequiredParameters = new Map < string , RequiredParameter [ ] > ( ) ;
129+ for ( const type of typeIds ) {
130+ const resourceInfo = await this . getResourceInfo ( type ) ;
131+
132+ const { schema } = resourceInfo ;
133+ if ( ! schema ) {
134+ continue ;
135+ }
136+
137+ const requiredParameterNames = resourceInfo . import ?. requiredParameters ;
138+ if ( ! requiredParameterNames || requiredParameterNames . length === 0 ) {
139+ continue ;
140+ }
141+
142+ requiredParameterNames
143+ . forEach ( ( name ) => {
144+ if ( ! allRequiredParameters . has ( type ) ) {
145+ allRequiredParameters . set ( type , [ ] ) ;
146+ }
147+
148+ const schemaInfo = ( schema . properties as any ) [ name ] ;
149+
150+ allRequiredParameters . get ( type ) ! . push ( {
151+ name,
152+ type : schemaInfo . type ?? null
153+ } )
154+ } ) ;
155+ }
156+
157+ return allRequiredParameters ;
158+ }
159+
125160 private async resolvePlugins ( project : Project | null ) : Promise < Plugin [ ] > {
126161 const pluginDefinitions : Record < string , string > = {
127162 ...DEFAULT_PLUGINS ,
0 commit comments