import { Result } from "@webiny/feature/api"; import type { IEventHandler, DomainEvent } from "../../../features/eventPublisher/index.js"; import type { Tenant } from "../../../types/tenancy.js"; import type { TenantInstalledPayload } from "./events.js"; import { InstallTenantError, InstallationDependencyError } from "./errors.js"; export type { Tenant }; /** * Errors */ export interface IInstallTenantErrors { base: InstallTenantError; dependency: InstallationDependencyError; } /** * Types */ export interface AppInstallationData { app: string; data: Record; } export interface TenantInstallationInput { tenant: Tenant; installationInput: AppInstallationData[]; } export interface IAppInstaller> { readonly alwaysRun?: boolean; readonly appName: string; readonly dependsOn: string[]; /** * Perform the installation * If this succeeds, uninstall() MUST be able to revert it */ install(tenant: Tenant, data: TData): Promise; /** * Revert the installation * Called if any subsequent installer fails */ uninstall(tenant: Tenant): Promise; } /** Install an application on a tenant with rollback support. */ export declare const AppInstaller: import("@webiny/di").Abstraction>>; export declare namespace AppInstaller { type Interface = IAppInstaller; } export interface IInstallTenantUseCase { execute(input: TenantInstallationInput): Promise>; } /** Run all app installers for a tenant. */ export declare const InstallTenantUseCase: import("@webiny/di").Abstraction; export declare namespace InstallTenantUseCase { type Interface = IInstallTenantUseCase; type Input = TenantInstallationInput; type Errors = IInstallTenantErrors[keyof IInstallTenantErrors]; } /** Hook into tenant lifecycle after a tenant is installed. */ export declare const TenantInstalledEventHandler: import("@webiny/di").Abstraction>>; export declare namespace TenantInstalledEventHandler { type Interface = IEventHandler>; type Event = DomainEvent; }