-
Notifications
You must be signed in to change notification settings - Fork 92
/
nconf.d.ts
94 lines (76 loc) · 3.36 KB
/
nconf.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
declare module "nconf" {
export var version: number;
export var stores: any;
export var sources: any[];
export function clear(key: string, callback?: ICallbackFunction): any;
export function get (key: string, callback?: ICallbackFunction): any;
export function merge(key: string, value: any, callback?: ICallbackFunction): any;
export function set (key: string, value: any, callback?: ICallbackFunction): any;
export function reset(callback?: ICallbackFunction): any;
export function load(callback?: ICallbackFunction): any;
export function mergeSources(data: any): void;
export function loadSources(): any;
export function save(value: any, callback?: ICallbackFunction): any;
export function add(name: string, options?: IOptions): Provider;
export function argv(options?: IOptions): Provider;
export function env(options?: IOptions): Provider;
export function file(name: string, options?: IFileOptions): Provider;
export function file(options: IFileOptions): Provider;
export function use(name: string, options?: IOptions): Provider;
export function defaults(options?: IOptions): Provider;
export function init(options?: IOptions): void;
export function overrides(options?: IOptions): Provider;
export function remove(name: string): void;
export function create(name: string, options: IOptions): IStore;
export function key(...values: any[]): string;
export function path(key: any): any[];
export function loadFiles(files: any, callback?: ICallbackFunction);
export function loadFilesSync(files: any, callback?: ICallbackFunction);
export enum formats {
json,
ini
}
export interface IOptions {
type?: string;
}
export interface IFileOptions extends IOptions {
file?: string;
dir?: string;
search?: boolean;
json_spacing?: number;
}
export interface ICallbackFunction { (err?: any); }
export class Provider {
constructor(options: IOptions);
stores: any;
sources: any[];
clear(key: string, callback?: ICallbackFunction): any;
get (key: string, callback?: ICallbackFunction): any;
merge(key: string, value: any, callback?: ICallbackFunction): any;
set (key: string, value: any, callback?: ICallbackFunction): any;
reset(callback?: ICallbackFunction): any;
load(callback?: ICallbackFunction): any;
mergeSources(data: any): void;
loadSources(): any;
save(value: any, callback?: ICallbackFunction): any;
add(name: string, options?: IOptions): Provider;
argv(options?: IOptions): Provider;
env(options?: IOptions): Provider;
file(name: string, options?: IFileOptions): Provider;
file(options: IFileOptions): Provider;
use(name: string, options?: IOptions): Provider;
defaults(options?: IOptions): Provider;
init(options?: IOptions): void;
overrides(options?: IOptions): Provider;
remove(name: string): void;
create(name: string, options: IOptions): IStore;
}
export interface IStore {
type: string;
get (key: string): any;
set (key: string, value: any): boolean;
clear(key: string): boolean;
merge(key: string, value: any): boolean;
reset(callback?: ICallbackFunction): boolean;
}
}