@atomist/sdm-pack-aspect
Version:
an Atomist SDM Extension Pack for visualizing drift across an organization
60 lines • 2.1 kB
TypeScript
import { FP } from "@atomist/sdm-pack-fingerprint";
/**
* Flag for an undesirable usage
*/
export interface ProblemUsage {
readonly severity: "info" | "warn" | "error";
/**
* Authority this comes from
*/
readonly authority: string;
/**
* Message to the user
*/
readonly description?: string;
/**
* URL associated with this if one is available.
* For example, a security advisory.
*/
readonly url?: string;
/**
* The fingerprint we object to
*/
readonly fingerprint: FP;
}
/**
* Persistent store of problem fingerprints
*/
export interface ProblemStore {
noteProblem(workspaceId: string, fingerprintId: string): Promise<void>;
storeProblemFingerprint(workspaceId: string, problem: ProblemUsage): Promise<void>;
loadProblems(workspaceId: string): Promise<ProblemUsage[]>;
}
/**
* Check to see if the given fingerprint is undesirable in the given workspace.
* Enables code to be used along with fingerprints persisted in ProblemStore.
*/
export declare type UndesirableUsageCheck = (fp: FP, workspaceId: string) => ProblemUsage[];
/**
* Type that can flag an issue with a fingerprint.
* This is a programmatic complement to ProblemStore.
*/
export interface UndesirableUsageChecker {
check: UndesirableUsageCheck;
}
/**
* Don't report any problems
*/
export declare const AcceptEverythingUndesirableUsageChecker: UndesirableUsageChecker;
/**
* Create an UndesirableUsageChecker from a list of problem-finding functions
*/
export declare function chainUndesirableUsageCheckers(...checkers: Array<(fp: FP, workspaceId: string) => ProblemUsage | ProblemUsage[] | undefined>): UndesirableUsageChecker;
/**
* Undesirable usageChecker backed by a ProblemStore for the given workspace
* @param {ProblemStore} problemStore
* @param {string} workspaceId
* @return {Promise<UndesirableUsageChecker>}
*/
export declare function problemStoreBackedUndesirableUsageCheckerFor(problemStore: ProblemStore, workspaceId: string): Promise<UndesirableUsageChecker>;
//# sourceMappingURL=ProblemStore.d.ts.map