@atomist/sdm-pack-aspect
Version:
an Atomist SDM Extension Pack for visualizing drift across an organization
57 lines • 2.14 kB
TypeScript
import { Project } from "@atomist/automation-client";
import { PushImpactListenerInvocation } from "@atomist/sdm";
import { Aspect, FP } from "@atomist/sdm-pack-fingerprint";
import { Tagger } from "../AspectRegistry";
import { AspectMetadata } from "./commonTypes";
export interface Classifier {
/**
* Reason for this classification.
*/
readonly reason: string;
/**
* Classification this instance will return
*/
readonly tags: string | string[];
}
export interface ProjectClassifier extends Classifier {
/**
* Test for whether the given project meets this classification
*/
test: (p: Project, pili: PushImpactListenerInvocation) => Promise<boolean>;
}
export interface DerivedClassifier extends Classifier {
/**
* Test for whether the given project meets this classification
*/
testFingerprints: (fps: FP[], p: Project, pili: PushImpactListenerInvocation) => Promise<boolean>;
}
export declare type EligibleClassifier = ProjectClassifier | DerivedClassifier | Tagger;
export interface ClassificationData {
/**
* Description for this classification
*/
readonly description: string;
/**
* Reason for this specific classification decision
*/
readonly reason: string;
}
export declare function isClassificationDataFingerprint(fp: FP): fp is FP<ClassificationData>;
export declare type ClassificationAspect = Aspect<ClassificationData> & {
classifierMetadata: Classifier[];
};
export declare function isClassificationAspect(a: Aspect): a is ClassificationAspect;
export interface ClassificationOptions extends AspectMetadata {
/**
* Stop at the first matched tag?
*/
stopAtFirst?: boolean;
}
/**
* Classify the project uniquely or otherwise
* undefined to return no fingerprint
* @param opts: Whether to allow multiple tags and whether to compute a fingerprint in all cases
* @param classifiers classifier functions
*/
export declare function projectClassificationAspect(opts: ClassificationOptions, ...classifiers: EligibleClassifier[]): ClassificationAspect;
//# sourceMappingURL=classificationAspect.d.ts.map