UNPKG

1.04 kBTypeScriptView Raw
1import { json, yaml, ini } from 'mrm-core';
2import { File } from './File';
3/**
4 * Exposes the API to work with key/value pair files like `ini`, `yaml`
5 * and `json`.
6 */
7export declare abstract class KeyValuePair extends File {
8 protected actions: never[];
9 /**
10 * Only these key-value pair files are supported
11 */
12 abstract filePointer: ReturnType<typeof json> | ReturnType<typeof yaml> | ReturnType<typeof ini>;
13 constructor(basePath: string);
14 /**
15 * Set key/value pair
16 */
17 set(key: string, value: any): this;
18 /**
19 * Unset key/value pair
20 */
21 unset(key: string): this;
22 /**
23 * Remove file
24 */
25 delete(): this;
26 /**
27 * Returns value for a given key from the file
28 */
29 get(): any;
30 get(address: string | string[], defaultValue?: any): any;
31 /**
32 * A boolean telling if the file already exists
33 */
34 exists(): boolean;
35 /**
36 * Commit mutations
37 */
38 commit(): void;
39 /**
40 * Rollback mutations
41 */
42 rollback(): void;
43}