UNPKG

@atomist/sdm

Version:

Atomist Software Delivery Machine SDK

50 lines 1.48 kB
import { HandlerContext } from "@atomist/automation-client/lib/HandlerContext"; /** * Creates a PreferenceStore instance provided the HandlerContext of the current execution */ export declare type PreferenceStoreFactory = (ctx: HandlerContext) => PreferenceStore; /** * Scope of a preference */ export declare enum PreferenceScope { Sdm = "sdm", Workspace = "workspace" } /** * Strategy to store and retrieve SDM preferences. */ export interface PreferenceStore { /** * Retrieve a preference object via its key in the given scope. */ get<V>(key: string, options?: { scope?: PreferenceScope | string; defaultValue?: V; }): Promise<V | undefined>; /** * Store a preference object with the specified ttl and scope. */ put<V>(key: string, value: V, options?: { scope?: PreferenceScope | string; ttl?: number; }): Promise<V>; /** * List all preferences in a given scope */ list<V>(scope: PreferenceScope | string): Promise<Array<{ key: string; value: V; }>>; /** * Delete a preference in a given scope */ delete(key: string, options?: { scope?: PreferenceScope | string; }): Promise<void>; } /** * NoOp PreferenceStore implementation useful for situations in which * the SDM does not support preferences or tests. */ export declare const NoPreferenceStore: PreferenceStore; //# sourceMappingURL=preferenceStore.d.ts.map