@@ -65,7 +65,8 @@ app.get("/functions/:region/:name/invocations", async (c) => {
6565 const endTs = end . getTime ( ) ;
6666
6767 const startKey = c . req . query ( "startKey" ) ;
68- const { Items, LastEvaluatedKey } = await query ( {
68+
69+ const params = {
6970 KeyConditionExpression : "#pk = :pk AND #sk BETWEEN :skStart AND :skEnd" ,
7071 ExclusiveStartKey : startKey ? JSON . parse ( startKey ) : undefined ,
7172 ExpressionAttributeNames : {
@@ -77,17 +78,31 @@ app.get("/functions/:region/:name/invocations", async (c) => {
7778 "#region" : "region" ,
7879 "#name" : "name" ,
7980 "#statusCode" : "statusCode" ,
81+ "#resultSummary" : "resultSummary" ,
8082 } ,
8183 ExpressionAttributeValues : {
8284 ":pk" : `function#${ c . req . param ( "region" ) } #${ c . req . param ( "name" ) } ` ,
8385 ":skStart" : `invocation#${ startTs } ` ,
8486 ":skEnd" : `invocation#${ endTs } ` ,
8587 } ,
8688 ProjectionExpression :
87- "#pk, #sk, #type, #error, #id, #region, #name, #statusCode, transactionId, started, ended, readiness, memoryAllocated" ,
89+ "#pk, #sk, #type, #error, #id, #region, #name, #statusCode, #resultSummary, transactionId, started, ended, readiness, memoryAllocated" ,
8890 Limit : 50 ,
8991 ScanIndexForward : false ,
90- } ) ;
92+ } ;
93+
94+ const resultSummaryFilters = c . req . query ( "resultSummaryFilters" ) ?. split ( ',' ) || [ ] ;
95+ if ( resultSummaryFilters . length ) {
96+ const filterExpression = [ ] ;
97+ for ( const filter of resultSummaryFilters ) {
98+ const variableName = `:f${ filterExpression . length } ` ;
99+ filterExpression . push ( `#resultSummary = ${ variableName } ` ) ;
100+ params . ExpressionAttributeValues [ variableName ] = filter ;
101+ }
102+ params . FilterExpression = filterExpression . join ( " OR " ) ;
103+ }
104+
105+ const { Items, LastEvaluatedKey } = await query ( params ) ;
91106
92107 return c . json ( {
93108 invocations : Items ,
0 commit comments