import { type AxiosInstance } from 'axios'; import type { GitInformation } from '../services/util'; import { SharedFile } from '../constructs'; export interface Project { name: string; logicalId: string; repoUrl?: string; } type ProjectResponse = Project & { id: string; created_at: string; }; export interface Change { logicalId: string; physicalId?: string | number; type: string; action: string; } export interface ResourceSync { logicalId: string; physicalId?: string | number; type: string; member: boolean; payload: any; } export interface AlertChannelFriendResource { type: 'alert-channel'; logicalId: string; physicalId: number; } export interface CheckGroupFriendResource { type: 'check-group'; logicalId: string; physicalId: number; } export interface PrivateLocationFriendResource { type: 'private-location'; logicalId: string; physicalId: string; } export interface StatusPageServiceFriendResource { type: 'status-page-service'; logicalId: string; physicalId: string; } export type FriendResourceSync = AlertChannelFriendResource | CheckGroupFriendResource | PrivateLocationFriendResource | StatusPageServiceFriendResource; export interface AuxiliaryResourceSync { physicalId?: string | number; type: string; payload: any; } export interface ProjectSync { project: Project; sharedFiles?: SharedFile[]; resources: Array; repoInfo: GitInformation | null; } export interface ProjectDeployResponse { project: Project; diff: Array; } export interface ImportPlanFilter { type: 'include' | 'exclude'; resource?: { type: string; physicalId?: string | number; }; } export interface ImportPlanFriend { type: string; logicalId: string; } export interface ImportPlanOptions { preview?: boolean; filters?: ImportPlanFilter[]; friends?: ImportPlanFriend[]; } export interface ImportPlanChanges { resources: ResourceSync[]; friends?: FriendResourceSync[]; auxiliary?: AuxiliaryResourceSync[]; } export interface ImportPlan { id: string; createdAt: string; appliedAt?: string; committedAt?: string; changes?: ImportPlanChanges; } export declare class ProjectNotFoundError extends Error { logicalId: string; constructor(logicalId: string, options?: ErrorOptions); } export declare class ProjectAlreadyExistsError extends Error { logicalId: string; constructor(logicalId: string, options?: ErrorOptions); } export declare class NoImportableResourcesFoundError extends Error { constructor(options?: ErrorOptions); } export declare class ImportPlanNotFoundError extends Error { constructor(options?: ErrorOptions); } export declare class InvalidImportPlanStateError extends Error { constructor(options?: ErrorOptions); } declare class Projects { api: AxiosInstance; constructor(api: AxiosInstance); getAll(): Promise>; /** * @throws {ProjectNotFoundError} If the project does not exist. */ get(logicalId: string): Promise>; /** * @throws {ProjectAlreadyExistsError} If the project already exists. */ create(project: Project): Promise>; /** * @throws {ProjectNotFoundError} If the project does not exist. */ deleteProject(logicalId: string, { preserveResources }?: { preserveResources?: boolean | undefined; }): Promise>; deploy(resources: ProjectSync, { dryRun, scheduleOnDeploy }?: { dryRun?: boolean | undefined; scheduleOnDeploy?: boolean | undefined; }): Promise>; /** * @throws {ProjectNotFoundError} If the project does not exist. * @throws {NoImportableResourcesFoundError} If no importable resources were found. */ createImportPlan(logicalId: string, options?: ImportPlanOptions): Promise>; /** * @throws {ProjectNotFoundError} If the project does not exist. */ findImportPlans(logicalId: string, { onlyUnapplied, onlyUncommitted }?: { onlyUnapplied?: boolean | undefined; onlyUncommitted?: boolean | undefined; }): Promise>; listImportPlans({ onlyUnapplied, onlyUncommitted }?: { onlyUnapplied?: boolean | undefined; onlyUncommitted?: boolean | undefined; }): Promise>; /** * @throws {ImportPlanNotFoundError} If the import plan does not exist. * @throws {InvalidImportPlanStateError} If the operation is performed out of order. */ cancelImportPlan(importPlanId: string): Promise>; /** * @throws {ImportPlanNotFoundError} If the import plan does not exist. * @throws {InvalidImportPlanStateError} If the operation is performed out of order. */ applyImportPlan(importPlanId: string): Promise>; /** * @throws {ImportPlanNotFoundError} If the import plan does not exist. * @throws {InvalidImportPlanStateError} If the operation is performed out of order. */ commitImportPlan(importPlanId: string): Promise>; } export default Projects;