1
- import { LambdaProps } from './types/lambdaProps.js' ;
2
1
import { LldConfig } from './types/lldConfig.js' ;
3
2
import { LambdaResource } from './types/resourcesDiscovery.js' ;
4
3
import * as crypto from 'crypto' ;
@@ -12,7 +11,7 @@ import { ResourceDiscovery } from './resourceDiscovery.js';
12
11
import { Logger } from './logger.js' ;
13
12
14
13
let config : LldConfig ;
15
- const lambdas : Record < string , LambdaProps > = { } ;
14
+ const lambdas : Record < string , LambdaResource > = { } ;
16
15
let lambdasList : LambdaResource [ ] | undefined = undefined ;
17
16
18
17
/**
@@ -103,34 +102,43 @@ async function generateDebuggerId(observableMode: boolean) {
103
102
* Add a Lambda to the configuration
104
103
* @param props
105
104
*/
106
- function addLambda ( props : Omit < LambdaProps , 'functionId' > ) {
105
+ function addLambda ( props : LambdaResource ) {
107
106
lambdas [ props . functionName ] = {
108
- functionId : props . functionName ,
109
107
...props ,
110
108
} ;
111
109
}
112
110
113
111
/**
114
- * Get a Lambda by functionId
115
- * @param functionId
112
+ * Get a Lambda by name
113
+ * @param functionName
116
114
* @returns
117
115
*/
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 ] ;
120
118
121
119
if ( lambda ) return lambda ;
122
120
123
- throw new Error ( `Lambda not found: ${ functionId } ` ) ;
121
+ throw new Error ( `Lambda not found: ${ functionName } ` ) ;
124
122
}
125
123
126
124
/**
127
125
* Get all Lambdas
128
126
* @returns
129
127
*/
130
- function getLambdas ( ) {
128
+ function getLambdasAll ( ) : LambdaResource [ ] {
131
129
return Object . values ( lambdas ) ;
132
130
}
133
131
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
+
134
142
/**
135
143
* Discover Lambdas
136
144
*/
@@ -180,7 +188,7 @@ function saveDiscoveredLambdas(lambdasListNew: LambdaResource[]) {
180
188
181
189
Logger . log ( 'Found the following Lambdas to debug:' ) ;
182
190
Logger . log (
183
- ` - ${ getLambdas ( )
191
+ ` - ${ getLambdasFiltered ( )
184
192
. map ( ( f ) => `${ f . functionName } code: ${ f . codePath } ` )
185
193
. join ( '\n - ' ) } `,
186
194
) ;
@@ -205,6 +213,7 @@ export const Configuration = {
205
213
} ,
206
214
discoverLambdas,
207
215
getLambda,
208
- getLambdas,
216
+ getLambdasAll,
217
+ getLambdasFiltered,
209
218
setConfig,
210
219
} ;
0 commit comments