import { type ISPEventObserver, type ServiceScope, SPEvent, type SPEventArgs } from '@microsoft/sp-core-library'; import type { IDynamicDataSource } from './interfaces/IDynamicDataSource'; import type { IDynamicDataManager } from './interfaces/IDynamicDataManager'; /** * Manager for Dynamic Data. * This holds a reference to all Dynamic Data Sources and uses the SPEventManager internally to handle * notifications for source updates. * * @remarks * Data sources can notify for changes within the data source or for a specific property. * Data consumers can register to both changes in a Dynamic Data source and a specific property within the source. * There are 3 events to handle this variety of situations: * * Notifying a change for a property triggers events for the specific property and for "any" property * Notifying a change for the whole source triggers events for "any" property and "all" properties. * * Registering for changes in a property register to events for the specific property and "all" properties. * Registering for changes in the whole source register to events for "any" properties. * * This ensures that regardless of how sources and consumers are configured, events will trigger once and only once for * each update within the data source. * * @internal */ export default class DynamicDataManager implements IDynamicDataManager { private _sources; private _sourcesChangedEvent; constructor(serviceScope: ServiceScope); /** * Event that gets raised when the list of Dynamic Data Sources gets updated. * @eventproperty */ get sourcesChangedEvent(): SPEvent; /** * Raises an event to all listeners when a Dynamic Data Source has been updated. * @param sourceId - Id of the Dynamic Data Source that is being updated. */ notifySourceChanged(sourceId: string): void; /** * Raises an event to all listeners when a property in a Dynamic Data Source has been updated. * @param sourceId - Id of the Dynamic Data Source whose property is being updated. * @param propertyId - Id of the property that is being updated. */ notifyPropertyChanged(sourceId: string, propertyId: string): void; /** * Registers a listener for updates on a Dynamic Data Source. */ registerSourceChanged(sourceId: string, observer: ISPEventObserver, callback: () => void): void; /** * Unregisters a listener for updates on a Dynamic Data Source. */ unregisterSourceChanged(sourceId: string, observer: ISPEventObserver, callback: () => void): void; /** * Registers a listener for updates on a Dynamic Data Source. */ registerPropertyChanged(sourceId: string, propertyId: string, observer: ISPEventObserver, callback: () => void): void; /** * Unregisters a listener for updates on a Dynamic Data Source. */ unregisterPropertyChanged(sourceId: string, propertyId: string, observer: ISPEventObserver, callback: () => void): void; /** * Returns a read-only array with all the existing Dynamic Data Sources. */ getSources(): ReadonlyArray; /** * Returns a Dynamic Data Source based on its id. * Returns undefined if the source doesn't exist. * @param sourceId - Id of the Dynamic Data Source. */ tryGetSource(sourceId: string): IDynamicDataSource | undefined; /** * Adds a new Dynamic Data Source to be managed. * Throws an error if the source can't be added. * * @param source - Dynamic Data Source to add. */ addSource(source: IDynamicDataSource): void; /** * Removes an existing Dynamic Data Source from the manager. * @param sourceId - Id of the Dynamic Data Source. */ removeSource(sourceId: string): void; /** * Creates a new extra data object _IQosExtraData. */ private _createQosExtraData; private _validateSource; /** * Raises an event when the Dynamic Data Sources gets updated. * @remarks * The event is sticky because sources can be updated before there is anyone listening. This way all clients * will get notified that sources have been updated. Further updates are notified in real-time. */ private _raiseSourcesChangedEvent; } //# sourceMappingURL=DynamicDataManager.d.ts.map