@@ -100,10 +100,10 @@ export interface PipeTransport {
100
100
* - For "code" configs this is the `projectRoot` field.
101
101
* - For "template" configs this is the `CodeUri` field in the template.
102
102
*/
103
- export function getCodeRoot (
103
+ export async function getCodeRoot (
104
104
folder : vscode . WorkspaceFolder | undefined ,
105
105
config : AwsSamDebuggerConfiguration
106
- ) : string | undefined {
106
+ ) : Promise < string | undefined > {
107
107
switch ( config . invokeTarget . target ) {
108
108
case 'code' : {
109
109
const codeInvoke = config . invokeTarget as CodeTargetProperties
@@ -112,11 +112,11 @@ export function getCodeRoot(
112
112
case 'api' :
113
113
case 'template' : {
114
114
const templateInvoke = config . invokeTarget as TemplateTargetProperties
115
- const template = getTemplate ( folder , config )
115
+ const template = await getTemplate ( folder , config )
116
116
if ( ! template ) {
117
117
return undefined
118
118
}
119
- const templateResource = getTemplateResource ( folder , config )
119
+ const templateResource = await getTemplateResource ( folder , config )
120
120
if ( ! templateResource ?. Properties ) {
121
121
return undefined
122
122
}
@@ -142,22 +142,22 @@ export function getCodeRoot(
142
142
/**
143
143
* Gets the lambda handler name specified in the given config.
144
144
*/
145
- export function getHandlerName (
145
+ export async function getHandlerName (
146
146
folder : vscode . WorkspaceFolder | undefined ,
147
147
config : AwsSamDebuggerConfiguration
148
- ) : string {
148
+ ) : Promise < string > {
149
149
switch ( config . invokeTarget . target ) {
150
150
case 'code' : {
151
151
const codeInvoke = config . invokeTarget as CodeTargetProperties
152
152
return codeInvoke . lambdaHandler
153
153
}
154
154
case 'api' :
155
155
case 'template' : {
156
- const template = getTemplate ( folder , config )
156
+ const template = await getTemplate ( folder , config )
157
157
if ( ! template ) {
158
158
return ''
159
159
}
160
- const templateResource = getTemplateResource ( folder , config )
160
+ const templateResource = await getTemplateResource ( folder , config )
161
161
if ( CloudFormation . isImageLambdaResource ( templateResource ?. Properties ) ) {
162
162
return config . invokeTarget . logicalId
163
163
}
@@ -184,32 +184,32 @@ export function getHandlerName(
184
184
}
185
185
186
186
/** Gets a template object from the given config. */
187
- export function getTemplate (
187
+ export async function getTemplate (
188
188
folder : vscode . WorkspaceFolder | undefined ,
189
189
config : AwsSamDebuggerConfiguration
190
- ) : CloudFormation . Template | undefined {
190
+ ) : Promise < CloudFormation . Template | undefined > {
191
191
if ( ! [ 'api' , 'template' ] . includes ( config . invokeTarget . target ) ) {
192
192
return undefined
193
193
}
194
194
const templateInvoke = config . invokeTarget as TemplateTargetProperties
195
195
const fullPath = tryGetAbsolutePath ( folder , templateInvoke . templatePath )
196
- const cfnTemplate = globals . templateRegistry . getRegisteredItem ( fullPath ) ?. item
196
+ const cfnTemplate = ( await globals . templateRegistry ) . getRegisteredItem ( fullPath ) ?. item
197
197
return cfnTemplate
198
198
}
199
199
200
200
/**
201
201
* Gets the template resources object specified by the `logicalId`
202
202
* field (if the config has `target=template` or `target=api`).
203
203
*/
204
- export function getTemplateResource (
204
+ export async function getTemplateResource (
205
205
folder : vscode . WorkspaceFolder | undefined ,
206
206
config : AwsSamDebuggerConfiguration
207
- ) : CloudFormation . Resource | undefined {
207
+ ) : Promise < CloudFormation . Resource | undefined > {
208
208
if ( ! [ 'api' , 'template' ] . includes ( config . invokeTarget . target ) ) {
209
209
return undefined
210
210
}
211
211
const templateInvoke = config . invokeTarget as TemplateTargetProperties
212
- const cfnTemplate = getTemplate ( folder , config )
212
+ const cfnTemplate = await getTemplate ( folder , config )
213
213
if ( ! cfnTemplate ) {
214
214
throw Error ( `template not found (not registered?): ${ templateInvoke . templatePath } ` )
215
215
}
@@ -231,8 +231,8 @@ export function getTemplateResource(
231
231
*
232
232
* Intended for use only by the language-specific `makeConfig` functions.
233
233
*/
234
- export function isImageLambdaConfig ( config : SamLaunchRequestArgs ) : boolean {
235
- const templateResource = getTemplateResource ( config . workspaceFolder , config )
234
+ export async function isImageLambdaConfig ( config : SamLaunchRequestArgs ) : Promise < boolean > {
235
+ const templateResource = await getTemplateResource ( config . workspaceFolder , config )
236
236
237
237
return CloudFormation . isImageLambdaResource ( templateResource ?. Properties )
238
238
}
0 commit comments