1- import { LambdaProps } from './types/lambdaProps.js' ;
21import { LldConfig } from './types/lldConfig.js' ;
32import { LambdaResource } from './types/resourcesDiscovery.js' ;
43import * as crypto from 'crypto' ;
@@ -12,7 +11,7 @@ import { ResourceDiscovery } from './resourceDiscovery.js';
1211import { Logger } from './logger.js' ;
1312
1413let config : LldConfig ;
15- const lambdas : Record < string , LambdaProps > = { } ;
14+ const lambdas : Record < string , LambdaResource > = { } ;
1615let lambdasList : LambdaResource [ ] | undefined = undefined ;
1716
1817/**
@@ -103,34 +102,43 @@ async function generateDebuggerId(observableMode: boolean) {
103102 * Add a Lambda to the configuration
104103 * @param props
105104 */
106- function addLambda ( props : Omit < LambdaProps , 'functionId' > ) {
105+ function addLambda ( props : LambdaResource ) {
107106 lambdas [ props . functionName ] = {
108- functionId : props . functionName ,
109107 ...props ,
110108 } ;
111109}
112110
113111/**
114- * Get a Lambda by functionId
115- * @param functionId
112+ * Get a Lambda by name
113+ * @param functionName
116114 * @returns
117115 */
118- async function getLambda ( functionId : string ) : Promise < LambdaProps > {
119- const lambda = lambdas [ functionId ] ;
116+ async function getLambda ( functionName : string ) : Promise < LambdaResource > {
117+ const lambda = lambdas [ functionName ] ;
120118
121119 if ( lambda ) return lambda ;
122120
123- throw new Error ( `Lambda not found: ${ functionId } ` ) ;
121+ throw new Error ( `Lambda not found: ${ functionName } ` ) ;
124122}
125123
126124/**
127125 * Get all Lambdas
128126 * @returns
129127 */
130- function getLambdas ( ) {
128+ function getLambdasAll ( ) : LambdaResource [ ] {
131129 return Object . values ( lambdas ) ;
132130}
133131
132+ /**
133+ * Get filtered Lambdas
134+ * @returns
135+ */
136+ function getLambdasFiltered ( ) {
137+ const list = Object . values ( lambdas ) ;
138+
139+ return list . filter ( ( l ) => ! l . filteredOut ) ;
140+ }
141+
134142/**
135143 * Discover Lambdas
136144 */
@@ -180,7 +188,7 @@ function saveDiscoveredLambdas(lambdasListNew: LambdaResource[]) {
180188
181189 Logger . log ( 'Found the following Lambdas to debug:' ) ;
182190 Logger . log (
183- ` - ${ getLambdas ( )
191+ ` - ${ getLambdasFiltered ( )
184192 . map ( ( f ) => `${ f . functionName } code: ${ f . codePath } ` )
185193 . join ( '\n - ' ) } `,
186194 ) ;
@@ -205,6 +213,7 @@ export const Configuration = {
205213 } ,
206214 discoverLambdas,
207215 getLambda,
208- getLambdas,
216+ getLambdasAll,
217+ getLambdasFiltered,
209218 setConfig,
210219} ;
0 commit comments