UNPKG

@atomist/sdm-core

Version:

Atomist Software Delivery Machine - Implementation

37 lines 1.44 kB
import { HandlerContext } from "@atomist/automation-client"; import { PreferenceScope, PreferenceStore } from "@atomist/sdm"; export interface Preference { name: string; namespace: string; value: string; ttl: number; } /** * Abstract PreferenceStore implementation to handle ttl and key scoping */ export declare abstract class AbstractPreferenceStore implements PreferenceStore { private readonly ctx; protected constructor(ctx: HandlerContext); get<V>(key: string, options?: { scope?: PreferenceScope | string; defaultValue?: V; }): Promise<V | undefined>; put<V>(key: string, value: V, options?: { scope?: PreferenceScope | string; ttl?: number; }): Promise<V>; list<V>(scope: PreferenceScope | string): Promise<Array<{ key: string; value: V; }>>; delete(key: string, options?: { scope?: PreferenceScope | string; }): Promise<void>; protected abstract doGet(key: string, namespace: string): Promise<Preference | undefined>; protected abstract doPut(pref: Preference): Promise<void>; protected abstract doList(namespace: string): Promise<Preference[]>; protected abstract doDelete(key: string, namespace: string): Promise<void>; protected scopeKey(key: string, scope?: string): string; protected scope(scope: PreferenceScope | string): string; } //# sourceMappingURL=AbstractPreferenceStore.d.ts.map