-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.d.ts
135 lines (135 loc) · 3.93 KB
/
settings.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
export type SettingsMap = {
[key: string]: any;
};
export declare const PROJECT_CONFIG = "cdk.json";
export declare const PROJECT_CONTEXT = "cdk.context.json";
export declare const USER_DEFAULTS = "~/.cdk.json";
/**
* If a context value is an object with this key set to a truthy value, it won't be saved to cdk.context.json
*/
export declare const TRANSIENT_CONTEXT_KEY = "$dontSaveContext";
export declare enum Command {
LS = "ls",
LIST = "list",
DIFF = "diff",
BOOTSTRAP = "bootstrap",
DEPLOY = "deploy",
DESTROY = "destroy",
SYNTHESIZE = "synthesize",
SYNTH = "synth",
METADATA = "metadata",
INIT = "init",
VERSION = "version",
WATCH = "watch"
}
export type Arguments = {
readonly _: [Command, ...string[]];
readonly exclusively?: boolean;
readonly STACKS?: string[];
readonly lookups?: boolean;
readonly [name: string]: unknown;
};
export interface ConfigurationProps {
/**
* Configuration passed via command line arguments
*
* @default - Nothing passed
*/
readonly commandLineArguments?: Arguments;
/**
* Whether or not to use context from `.cdk.json` in user home directory
*
* @default true
*/
readonly readUserContext?: boolean;
}
/**
* All sources of settings combined
*/
export declare class Configuration {
private readonly props;
settings: Settings;
context: Context;
readonly defaultConfig: Settings;
private readonly commandLineArguments;
private readonly commandLineContext;
private _projectConfig?;
private _projectContext?;
private loaded;
constructor(props?: ConfigurationProps);
private get projectConfig();
private get projectContext();
/**
* Load all config
*/
load(): Promise<this>;
/**
* Save the project context
*/
saveContext(): Promise<this>;
}
/**
* Class that supports overlaying property bags
*
* Reads come from the first property bag that can has the given key,
* writes go to the first property bag that is not readonly. A write
* will remove the value from all property bags after the first
* writable one.
*/
export declare class Context {
private readonly bags;
constructor(...bags: Settings[]);
get keys(): string[];
has(key: string): boolean;
get all(): {
[key: string]: any;
};
get(key: string): any;
set(key: string, value: any): void;
unset(key: string): void;
clear(): void;
}
/**
* A single bag of settings
*/
export declare class Settings {
private settings;
readonly readOnly: boolean;
/**
* Parse Settings out of CLI arguments.
*
* CLI arguments in must be accessed in the CLI code via
* `configuration.settings.get(['argName'])` instead of via `args.argName`.
*
* The advantage is that they can be configured via `cdk.json` and
* `$HOME/.cdk.json`. Arguments not listed below and accessed via this object
* can only be specified on the command line.
*
* @param argv the received CLI arguments.
* @returns a new Settings object.
*/
static fromCommandLineArguments(argv: Arguments): Settings;
static mergeAll(...settings: Settings[]): Settings;
private static parseStringContextListToObject;
/**
* Parse tags out of arguments
*
* Return undefined if no tags were provided, return an empty array if only empty
* strings were provided
*/
private static parseStringTagsListToObject;
constructor(settings?: SettingsMap, readOnly?: boolean);
load(fileName: string): Promise<this>;
save(fileName: string): Promise<this>;
get all(): any;
merge(other: Settings): Settings;
subSettings(keyPrefix: string[]): Settings;
makeReadOnly(): Settings;
clear(): void;
get empty(): boolean;
get(path: string[]): any;
set(path: string[], value: any): Settings;
unset(path: string[]): void;
private prohibitContextKey;
private warnAboutContextKey;
}