import { DataItem , DynamoDataModel , DynamoSearchResult , GitTag } from "stackjanitor" ; import { dataModel , dynamoDataModel } from "./data/DynamoDataModel" ; import { handleDataItem } from "./handlers/monitorCloudFormationStack" ; export const findStacksFromTag = ( gitTag , keyName ) : Promise < DataItem [ ] > => new Promise ( ( resolve , reject ) => dynamoDataModel . scan ( ) . where ( keyName ) . contains ( gitTag . repository ) . where ( keyName ) . contains ( gitTag . branch ) . exec ( ( err , data ) => err ? reject ( err ) : resolve ( data . Items . map ( ( item ) => item . attrs ) ) ) ) ; export const deleteDynamoRow = async ( dataItem ) => handleDataItem ( { stackName : dataItem . stackName , stackId : dataItem . stackId } , dataModel . destroy ) ;