import { Aspect , FP , sha256 , } from "@atomist/sdm-pack-fingerprint" ; import { VersionedArtifact } from "@atomist/sdm-pack-spring" ; import { findDeclaredDependencies } from "@atomist/sdm-pack-spring/lib/maven/parse/fromPom" ; const MavenDirectDep = "maven-direct-dep" ; /**
 * Emits direct dependencies only
 */ export const DirectMavenDependencies = { name : MavenDirectDep , displayName : "Direct Maven dependencies" , extract : async ( p ) => { const deps = await findDeclaredDependencies ( p ) ; return deps . dependencies . map ( gavToFingerprint ) ; } , apply : async ( p , papi ) => { return p ; } , toDisplayableFingerprintName : name => name , toDisplayableFingerprint : fp => { const version = JSON . parse ( fp . data ) . version ; return version ; } , } ; function gavToFingerprint ( gav ) { const data = JSON . stringify ( gav ) ; return { type : MavenDirectDep , name : `${ gav . group }:${ gav . artifact }` , abbreviation : "mvn" , version : "0.1.0" , data , sha : sha256 ( data ) , } ; }