import { ServiceNowInstance } from "../ServiceNowInstance.js"; import { ProgressResult } from "../ProgressWorker.js"; import { OperationProgressCallback } from "../OperationProgress.js"; /** * AppRepoApplication class for managing application repository operations * Provides methods to install applications from and publish applications to * a company's ServiceNow application repository using the CI/CD API */ export declare class AppRepoApplication { private readonly APP_REPO_INSTALL_API_URL; private readonly APP_REPO_PUBLISH_API_URL; private readonly PROGRESS_API_URL; private readonly DEFAULT_TIMEOUT; private readonly DEFAULT_POLL_INTERVAL; private _logger; private _req; private _instance; constructor(instance: ServiceNowInstance); /** * Installs an application from the application repository * @param request AppRepoInstallRequest containing installation parameters * @returns Promise Installation response with progress information */ installFromAppRepo(request: AppRepoInstallRequest): Promise; /** * Installs an application from the app repository and waits for completion * @param request AppRepoInstallRequest containing installation parameters * @param pollIntervalMs Polling interval in milliseconds (default: 5000) * @param timeoutMs Timeout in milliseconds (default: 30 minutes) * @returns Promise Final operation result */ installFromAppRepoAndWait(request: AppRepoInstallRequest, pollIntervalMs?: number, timeoutMs?: number, onProgress?: OperationProgressCallback): Promise; /** * Publishes an application to the application repository * @param request AppRepoPublishRequest containing publish parameters * @returns Promise Publish response with progress information */ publishToAppRepo(request: AppRepoPublishRequest): Promise; /** * Publishes an application to the app repository and waits for completion * @param request AppRepoPublishRequest containing publish parameters * @param pollIntervalMs Polling interval in milliseconds (default: 5000) * @param timeoutMs Timeout in milliseconds (default: 30 minutes) * @returns Promise Final operation result */ publishToAppRepoAndWait(request: AppRepoPublishRequest, pollIntervalMs?: number, timeoutMs?: number, onProgress?: OperationProgressCallback): Promise; /** * Gets the current progress of an app repo operation * @param progressId Progress ID from the operation response * @returns Promise Current progress information */ getProgress(progressId: string): Promise; /** * Waits for an app repo operation to complete * @param progressId Progress ID to monitor * @param pollIntervalMs Polling interval in milliseconds * @param timeoutMs Timeout in milliseconds * @returns Promise Final operation result */ private waitForCompletion; } /** * Request parameters for installing an application from the app repository */ export interface AppRepoInstallRequest { /** Required: Scope name of the application to install */ scope: string; /** Required: Sys ID of the application in the repository */ sys_id: string; /** Optional: Version of the application to install */ version?: string; /** Optional: Whether to automatically upgrade the base application if required (default: false) */ auto_upgrade_base_app?: boolean; /** Optional: Version of the base application to upgrade to */ base_app_version?: string; } /** * Request parameters for publishing an application to the app repository */ export interface AppRepoPublishRequest { /** Required: Scope name of the application to publish */ scope: string; /** Required: Sys ID of the application to publish */ sys_id: string; /** Optional: Version number for the published application */ version?: string; /** Optional: Developer notes for this version */ dev_notes?: string; } /** * Response from app repo install operation */ export interface AppRepoInstallResponse { /** Links to related resources */ links: { progress: { id: string; url: string; }; }; /** Status code of the operation */ status: string; /** Human-readable status label */ status_label: string; /** Additional status message */ status_message: string; /** Detailed status information */ status_detail: string; /** Error message if operation failed */ error: string; /** Percentage of completion (0-100) */ percent_complete: number; } /** * Response from app repo publish operation */ export interface AppRepoPublishResponse { /** Links to related resources */ links: { progress: { id: string; url: string; }; }; /** Status code of the operation */ status: string; /** Human-readable status label */ status_label: string; /** Additional status message */ status_message: string; /** Detailed status information */ status_detail: string; /** Error message if operation failed */ error: string; /** Percentage of completion (0-100) */ percent_complete: number; } /** * Final result of an app repo operation after completion */ export interface AppRepoOperationResult { /** Whether the operation completed successfully */ success: boolean; /** Status code */ status: string; /** Status label */ status_label: string; /** Status message */ status_message: string; /** Detailed status */ status_detail: string; /** Error message if any */ error: string; /** Final completion percentage */ percent_complete: number; /** Links to related resources */ links: { progress: { id: string; url: string; }; results?: { id: string; url: string; }; }; }