UNPKG

3.6 kBTypeScriptView Raw
1// tslint:disable-next-line:ban-types
2declare type StrategyConstructor<T> = Function & { prototype: T };
3/**
4 * @class
5 */
6export declare class ConfigurationBase {
7 /**
8 * Gets the current configuration
9 * @returns ConfigurationBase - An instance of DataConfiguration class which represents the current data configuration
10 */
11 public static getCurrent(): ConfigurationBase;
12 /**
13 * Sets the current configuration
14 * @param {ConfigurationBase} configuration
15 * @returns ConfigurationBase - An instance of ApplicationConfiguration class which represents the current configuration
16 */
17 public static setCurrent(configuration: ConfigurationBase): any;
18 public readonly settings: any;
19 /**
20 * @constructor
21 * @param {string=} configPath
22 */
23 constructor(configPath?: string);
24 /**
25 * Register a configuration strategy
26 * @param {Function} strategyBaseCtor
27 * @param {Function=} strategyCtor
28 * @returns ConfigurationBase
29 */
30 public useStrategy(strategyBaseCtor: any, strategyCtor?: any): this;
31 /**
32 * Gets a configuration strategy
33 * @param {Function} strategyBaseCtor
34 * @returns {ConfigurationStrategy|*}
35 */
36 getStrategy<T>(strategyBaseCtor: StrategyConstructor<T>): T;
37 /**
38 * Gets a configuration strategy
39 * @param {Function} strategyBaseCtor
40 */
41 public hasStrategy<T>(strategyBaseCtor: StrategyConstructor<T>): boolean;
42 /**
43 * Returns the configuration source object
44 * @returns {*}
45 */
46 public getSource(): any;
47 /**
48 * Returns the source configuration object based on the given path (e.g. settings.auth.cookieName or settings/auth/cookieName)
49 * @param {string} p - A string which represents an object path
50 * @returns {Object|Array}
51 */
52 public getSourceAt(p: string): any;
53 /**
54 * Returns a boolean which indicates whether the specified object path exists or not (e.g. settings.auth.cookieName or settings/auth/cookieName)
55 * @param {string} p - A string which represents an object path
56 * @returns {boolean}
57 */
58 public hasSourceAt(p: string): boolean;
59 /**
60 * Sets the config value to the specified object path (e.g. settings.auth.cookieName or settings/auth/cookieName)
61 * @param {string} p - A string which represents an object path
62 * @param {*} value
63 * @returns {Object}
64 */
65 public setSourceAt(p: any, value: any): any;
66 /**
67 * Sets the current execution path
68 * @param {string} p
69 */
70 public setExecutionPath(p: string): ConfigurationBase;
71 /**
72 * Gets the current execution path
73 * @returns {string}
74 */
75 public getExecutionPath(): string;
76 /**
77 * Gets the current configuration path
78 * @returns {string}
79 */
80 public getConfigurationPath(): string;
81}
82/**
83 * @class
84 */
85export declare class ConfigurationStrategy {
86 /**
87 * @constructor
88 * @param {ConfigurationBase} config
89 */
90 constructor(config: ConfigurationBase);
91 /**
92 * @returns {ConfigurationBase}
93 */
94 public getConfiguration(): ConfigurationBase;
95}
96export declare class ModuleLoaderStrategy extends ConfigurationStrategy {
97 /**
98 *
99 * @param {ConfigurationBase} config
100 */
101 constructor(config: ConfigurationBase);
102 /**
103 * @param {string} modulePath
104 * @returns {*}
105 */
106 public require(modulePath: any): any;
107}
108export declare class DefaultModuleLoaderStrategy extends ModuleLoaderStrategy {
109 /**
110 *
111 * @param {ConfigurationBase} config
112 */
113 constructor(config: any);
114}