@atomist/sdm-pack-fingerprints
Version:
an Atomist SDM Extension Pack for fingerprinting code
31 lines (30 loc) • 1.36 kB
TypeScript
import { BaseAspect, FP } from "./Aspect";
/**
* Do we consider that the particular fingerprint is relevant to this project,
* based on an intermediate format?
*/
export declare type RelevanceTest<SOURCE> = (fingerprintName: string, source: SOURCE) => boolean;
/**
* Aspect derived from some intermediate representation of a project such as a ProjectAnalysis.
* As with DerivedAspect, the intermediate calculation must have been completed in a previous phase.
*/
export interface DerivedAspect<SOURCE, FPI extends FP = FP> extends BaseAspect<FPI> {
/**
* Function to extract fingerprint(s) from an intermediate representation
* of this project. Implementation does not have access to the Project itself
* and should be relatively inexpensive as it depends on previously extracted
* data such as a ProjectAnalysis.
*/
derive: (source: SOURCE) => Promise<FPI | FPI[]>;
/**
* Is this aspect relevant to this project? For example, if
* we are tracking TypeScript version, is this even a Node project?
* Is the target at all relevant
*/
relevanceTest?: RelevanceTest<SOURCE>;
/**
* Is this aspect desired on this project, according to our standards?
*/
necessityTest?: RelevanceTest<SOURCE>;
}
export declare function isDerivedAspect(aspect: BaseAspect): aspect is DerivedAspect<any>;