import { IMessageBusTopicSubscription, SettingUpdatedMsg } from "../models"; export interface ISuggestedKeyRendererHandler { /** * Return an array of the registered html element name that has been suggested to be able to render this key * */ getSuggestedKeyRenderer: (key: string) => Promise; } export interface ISettingsKeyProvider extends ISettingsStorage { protectKeyWithSecurityRole: (securityRoleId: string) => void; } export interface ISettingsKeyProviderWithSuggestedRendererSupport extends ISettingsKeyProvider, ISuggestedKeyRendererHandler, ISettingsStorageWithRendererSuggestion { } export interface ISettingsService extends ISuggestedKeyRendererHandler { registerKeyProvider: (key: string, keyProvider: ISettingsKeyProvider) => void; } export interface ISettingsStorage { /** * Get the key value * * @param key the for which to get value. * @returns A promise containing the value */ getValue: (key: string) => Promise; /** * Checks if the current user has access to write the value for a specific key * * @param key for which to check access. * @returns A promise containing the boolean result of the access check */ canSetValue: (key: string) => Promise; /** * Sets a value for the given key * (Only succeed if current user has access to set key value, see CanSetValue) * * @param key for which to add the settings value. * @param value the value to persist for the key. * @returns A promise containing the value which has been persisted */ setValue: (key: string, value: T) => Promise; } export interface ISettingsStorageWithRendererSuggestion extends ISettingsStorage { /** * Registers a html element name i.e.web component that you what to handle the editing of settings) * (Only suggest element that you know kan handle the settings key's value model) * */ suggestKeyRenderer: (key: string, elementName: string) => void; } export interface SettingsServiceConstructor { securityRoleId: string; } export declare class SettingsService implements ISettingsStorage, ISettingsService { private securityRoleId; private static SuggestedKeyRenderers; private static KeyProviders; /** * Event dispatcher when a settings key has been updated */ private static KeyValueUpdatedPublishSubscribers; private static LoadedValues; private static SettingUpdatedPublishSubscriber; private httpClient; private permissionService; private settingsLoader; constructor(securityRoleId: string); onKeyValueUpdated: (key: string) => IMessageBusTopicSubscription; onSettingUpdated: () => IMessageBusTopicSubscription; registerKeyProvider: (key: string, keyProvider: ISettingsKeyProvider) => void; canSetValue(key: string): Promise; setValue(key: string, value: T): Promise; getValue(key: string): Promise; suggestKeyRenderer: (key: string, elementName: string) => void; getSuggestedKeyRenderer: (key: string) => Promise; private getKeyProvider; private settingUpdated; private getKeyValuePublishSubscriber; reloadSettingsHash(): void; }