UNPKG

1.12 kBTypeScriptView Raw
1import { Settings } from './settings';
2export { TRANSIENT_CONTEXT_KEY } from './settings';
3export declare const PROJECT_CONTEXT = "cdk.context.json";
4interface ContextBag {
5 /**
6 * The file name of the context. Will be used to potentially
7 * save new context back to the original file.
8 */
9 fileName?: string;
10 /**
11 * The context values.
12 */
13 bag: Settings;
14}
15/**
16 * Class that supports overlaying property bags
17 *
18 * Reads come from the first property bag that can has the given key,
19 * writes go to the first property bag that is not readonly. A write
20 * will remove the value from all property bags after the first
21 * writable one.
22 */
23export declare class Context {
24 private readonly bags;
25 private readonly fileNames;
26 constructor(...bags: ContextBag[]);
27 get keys(): string[];
28 has(key: string): boolean;
29 get all(): {
30 [key: string]: any;
31 };
32 get(key: string): any;
33 set(key: string, value: any): void;
34 unset(key: string): void;
35 clear(): void;
36 /**
37 * Save a specific context file
38 */
39 save(fileName: string): Promise<this>;
40}