@igo2/core
Version:
66 lines (59 loc) • 2.14 kB
TypeScript
import * as i0 from '@angular/core';
import { ModuleWithProviders, InjectionToken, EnvironmentProviders } from '@angular/core';
import * as rxjs from 'rxjs';
/**
* @deprecated import the provideConfig directly
*/
declare class IgoConfigModule {
static forRoot(): ModuleWithProviders<IgoConfigModule>;
static ɵfac: i0.ɵɵFactoryDeclaration<IgoConfigModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<IgoConfigModule, never, never, never>;
static ɵinj: i0.ɵɵInjectorDeclaration<IgoConfigModule>;
}
interface ConfigOptions<T = Record<string, any>> {
/** This is a representation of EnvironmentOptions */
default?: T;
path?: string;
}
interface DeprecatedOptions {
alternativeKey?: string;
mayBeRemoveIn: Date;
}
interface AlternateConfigOptions {
deprecatedKey: string;
}
declare const CONFIG_OPTIONS: InjectionToken<ConfigOptions<Record<string, any>>>;
declare function provideConfig(options: ConfigOptions): EnvironmentProviders;
declare class ConfigService<T extends object = Record<string, any>> {
private config;
private httpClient;
private configDeprecated;
private _isLoaded$;
isLoaded$: rxjs.Observable<boolean>;
constructor();
/**
* Use to get the all config file (merge from environnement.ts and config.json)
*/
getConfigs(): any;
/**
* Use to get the data found in config file
*/
getConfig<T = any>(key: string, defaultValue?: unknown): T;
private handleDeprecatedConfig;
private handleDeprecationPossibility;
/**
* This method loads "[path]" to get all config's variables
*/
load(options: ConfigOptions<T>): void | Promise<unknown>;
static ɵfac: i0.ɵɵFactoryDeclaration<ConfigService<any>, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ConfigService<any>>;
}
interface Version {
app?: string;
lib?: string;
releaseDateApp?: number;
releaseDate?: number;
}
declare const version: Version;
export { CONFIG_OPTIONS, ConfigService, IgoConfigModule, provideConfig, version };
export type { AlternateConfigOptions, ConfigOptions, DeprecatedOptions, Version };