UNPKG

@eclipse-scout/core

Version:
65 lines 4.22 kB
/// <reference types="jquery" /> import { BaseDoEntity, ConfigProperties, ObjectModel } from '../index'; /** * Cache for {@link ConfigProperty} instances by backend system. */ export declare class ConfigPropertyCache implements ObjectModel<ConfigPropertyCache> { objectType: string; configMap: Map<string, Map<string, ConfigProperty<any>>>; constructor(); /** * Loads config properties from the given system using the configuration of that {@link System}. * @param system The optional system name to which the properties belong. By default, {@link System.MAIN_SYSTEM} is used. */ bootstrapSystem(system?: string): JQuery.Promise<void>; /** * Adds the {@link ConfigProperty} instances returned by the urls given to the properties map of the given system. * @param urls The urls to fetch the properties from. Typically, 'res/config-properties.json' for the UI backend and/or 'api/config-properties' for the server backend. * @param system The optional system name to which the properties belong. By default, {@link System.MAIN_SYSTEM} is used. */ bootstrap(urls: string | string[], system?: string): JQuery.Promise<void>; /** * Add the {@link ConfigProperty} instances given to the system given. If a property with the same key already exists, its value is overwritten. * @param data The properties to add. * @param system The optional system name to which the properties belong. By default, {@link System.MAIN_SYSTEM} is used. */ protected _handleBootstrapResponse(data?: ConfigPropertyDo | ConfigPropertyDo[], system?: string): void; protected _handleBootstrapProperty(property?: ConfigPropertyDo, system?: string): void; protected _getSystemMap(system?: string): Map<string, ConfigProperty<any>>; /** * Gets the {@link ConfigProperty} with given key. Optionally from a specific backend system. * * The method only returns properties which have already been loaded from the backend. * If the property might not already been loaded, use {@link load} instead. * @param key The key of the config property that should be returned. * @param system An optional system from which the property should be. By default, {@link System.MAIN_SYSTEM} is used. */ get<TKey extends keyof ConfigProperties[TSystem] & string, TSystem extends keyof ConfigProperties & string = 'main'>(key: TKey, system?: TSystem): ConfigProperty<ConfigProperties[TSystem][TKey]>; /** * Adds a property. If there is already an existing property with the same key, its value is overwritten. * @param key The key of the property. * @param value The new value of the property. * @param system An optional system to which the property belongs. By default, {@link System.MAIN_SYSTEM} is used. * @returns The created {@link ConfigProperty}. */ set<TKey extends keyof ConfigProperties[TSystem] & string, TValue extends ConfigProperties[TSystem][TKey], TSystem extends keyof ConfigProperties & string = 'main'>(key: TKey, value: TValue, system?: TSystem): ConfigProperty<TValue>; /** * Loads the properties from the given system and returns the value of the property with the given key. * * To configure the system URL use {@link systems.getOrCreate} and {@link System.setEndpointUrl} for endpointName 'config-properties' if required. * @param key The key of the property that should be returned. * @param system An optional system from which the property should be loaded. By default, {@link System.MAIN_SYSTEM} is used. * @returns a promise that when resolved returns the newly loaded property with the given key. */ load<TKey extends keyof ConfigProperties[TSystem] & string, TSystem extends keyof ConfigProperties & string = 'main'>(key: TKey, system?: TSystem): JQuery.Promise<ConfigProperty<ConfigProperties[TSystem][TKey]>>; } export declare class ConfigPropertyDo extends BaseDoEntity implements ConfigProperty<any> { key: string; value: any; } export interface ConfigProperty<TValue> { key: string; value: TValue; } export declare const config: ConfigPropertyCache; //# sourceMappingURL=ConfigPropertyCache.d.ts.map