import { type Observable, type ObservableInput } from 'rxjs'; import { type IHttpClient } from '@equinor/fusion-framework-module-http'; import type { AppBuildManifest, AppConfig, AppManifest, AppSettings, ConfigEnvironment } from './types'; /** * Contract for an app service client that fetches application manifests, * build metadata, configurations, and per-user settings from the Fusion apps API. * * All methods return `ObservableInput` so consumers can use either `Observable` * or `Promise`-based consumption patterns. */ export interface IAppClient extends Disposable { /** * Fetches the manifest for a single application. * * @param args - Object containing the `appKey` and an optional version `tag`. * @returns An observable that emits the resolved {@link AppManifest}. * @throws {AppManifestError} When the manifest cannot be loaded (404, 401, 410, or unknown). */ getAppManifest: (args: { appKey: string; tag?: string; }) => ObservableInput; /** * Fetches the build metadata (entry point, version, asset path) for an application. * * @param args - Object containing the `appKey` and an optional version `tag`. * @returns An observable that emits the resolved {@link AppBuildManifest}. * @throws {AppBuildError} When the build metadata cannot be loaded. */ getAppBuild: (args: { appKey: string; tag?: string; }) => ObservableInput; /** * Fetches manifests for all registered applications. * * @param args - Optional filter; set `filterByCurrentUser` to `true` to return * only apps the authenticated user has access to. * @returns An observable that emits an array of {@link AppManifest} objects. */ getAppManifests: (args?: { filterByCurrentUser?: boolean; }) => ObservableInput; /** * Fetches the runtime configuration (environment variables and endpoints) for an application. * * @template TType - Shape of the `environment` record in the returned config. * @param args - Object containing the `appKey` and an optional version `tag`. * @returns An observable that emits the resolved {@link AppConfig}. * @throws {AppConfigError} When the configuration cannot be loaded. */ getAppConfig: (args: { appKey: string; tag?: string; }) => ObservableInput>; /** * Fetches per-user settings for an application. * * @param args - Object containing the `appKey`. * @returns An observable that emits the {@link AppSettings} record. * @throws {AppSettingsError} When settings cannot be loaded. */ getAppSettings: (args: { appKey: string; }) => ObservableInput; /** * Persists updated per-user settings for an application via PUT. * * @param args - Object containing the `appKey` and the `settings` payload to save. * @returns An observable that emits the persisted {@link AppSettings}. * @throws {AppSettingsError} When the update request fails. */ updateAppSettings: (args: { appKey: string; settings: AppSettings; }) => ObservableInput; } /** * Default implementation of {@link IAppClient} that communicates with the * Fusion app service API over HTTP. * * Uses {@link Query} internally for request deduplication and caching * (1-minute expiry by default). Responses are validated against Zod schemas * ({@link ApiApplicationSchema}, {@link ApiApplicationBuildSchema}) and * HTTP errors are mapped to typed error classes. * * @example * ```ts * const httpClient = await http.createClient('apps'); * const appClient = new AppClient(httpClient); * appClient.getAppManifest({ appKey: 'my-app' }).subscribe(console.log); * ``` */ export declare class AppClient implements IAppClient { #private; constructor(client: IHttpClient); getAppBuild(args: { appKey: string; tag?: string; }): Observable; getAppManifest(args: { appKey: string; tag?: string; }): Observable; getAppManifests(args: { filterByCurrentUser?: boolean; } | undefined): Observable; getAppConfig(args: { appKey: string; tag?: string; }): Observable>; getAppSettings(args: { appKey: string; }): Observable; updateAppSettings(args: { appKey: string; settings: AppSettings; }): Observable; [Symbol.dispose](): void; } export default AppClient;