import { type Observable } from 'rxjs'; import type { ModuleType } from '@equinor/fusion-framework-module'; import type { EventModule } from '@equinor/fusion-framework-module-event'; import type { AppConfig, AppManifest, AppReference, AppSettings, ConfigEnvironment, CurrentApp } from './types'; import { App, type IApp } from './app/App'; import type { AppModuleConfig } from './AppConfigurator'; import type { AppBundleStateInitial } from './app/types'; import { SemanticVersion } from '@equinor/fusion-framework-module'; /** * Runtime provider for the app module. * * Exposes methods for fetching application manifests, configurations, and user * settings, and for setting or clearing the current active application. When an * {@link EventModule} is available, lifecycle events are dispatched as the * current app changes. * * @remarks * Only one application can be active (`current`) at a time. Setting a new current * app automatically disposes the previous one. Subscribe to {@link current$} for * reactive updates. */ export declare class AppModuleProvider { #private; /** * Shallow-compares two app manifests by JSON serialization. * * @param a - First manifest to compare. * @param b - Second manifest to compare. * @returns `true` if the serialized manifests are identical. */ static compareAppManifest(a?: T, b?: T): boolean; /** * Get module version */ get version(): SemanticVersion; /** * The current active application instance. * * - `undefined` – no application has been set yet. * - `null` – the current application was explicitly cleared. * - `App` – an active application instance. */ get current(): CurrentApp | null | undefined; /** * Observable that emits when the current application changes. * * Emits are deduplicated by `appKey`; re-setting the same app does not trigger * a new emission. */ get current$(): Observable; /** * Creates the app module provider. * * @param args - Object containing the resolved {@link AppModuleConfig} and an * optional {@link EventModule} instance for dispatching lifecycle events. */ constructor(args: { config: AppModuleConfig; event?: ModuleType; }); /** * Fetches the manifest for a single application by key. * * @param appKey - Unique application identifier. * @param tag - Optional version tag (defaults to latest). * @returns An observable that emits the resolved {@link AppManifest}. */ getAppManifest(appKey: string, tag?: string): Observable; /** * Fetches manifests for all registered applications. * * @param filter - Optional filter; set `filterByCurrentUser` to `true` to scope * results to apps accessible by the authenticated user. * @returns An observable that emits an array of {@link AppManifest} objects. */ getAppManifests(filter?: { filterByCurrentUser: boolean; }): Observable; /** * fetch all applications * @deprecated use `getAppManifests` instead */ getAllAppManifests(): Observable; /** * Fetches the runtime configuration for an application. * * @template TType - Shape of the `environment` record in the returned config. * @param appKey - Unique application identifier. * @param tag - Optional version tag. * @returns An observable that emits the resolved {@link AppConfig}. */ getAppConfig(appKey: string, tag?: string): Observable>; /** * Fetches per-user settings for an application. * * @param appKey - Unique application identifier. * @returns An observable that emits the {@link AppSettings} record. */ getAppSettings(appKey: string): Observable; /** * Persists updated per-user settings for an application. * * @param appKey - Unique application identifier. * @param settings - The settings record to save. * @returns An observable that emits the persisted {@link AppSettings}. */ updateAppSettings(appKey: string, settings: AppSettings): Observable; /** * Sets the current active application. * * Accepts an app key string, an {@link IApp} instance, or an {@link AppReference} * with both `appKey` and `tag`. Setting a new app disposes the previous one. * * @param appKeyOrApp - Application key, app reference, or an existing `IApp` instance. */ setCurrentApp(appKeyOrApp: string | IApp | AppReference): void; /** * Clears the current application, disposing its resources and emitting `null` * on {@link current$}. */ clearCurrentApp(): void; /** * Base URI used for proxying application script imports. */ get assetUri(): string; /** * This should not be used, only for legacy creation backdoor * @deprecated */ createApp(value: AppBundleStateInitial): App; /** * Tears down the provider, unsubscribing from all internal observables. */ dispose(): void; } export default AppModuleProvider;