krona-staff/scripts/rehome-tenant.d.mts
2026-09-29 12:21:57 +07:00

50 lines
1.3 KiB
TypeScript

import type { Client } from 'pg';
export interface BackupEvidenceReport {
backup: {
format: 'pg_dump -Fc';
encrypted: true;
offHost: true;
sha256: string;
createdAt: string;
};
restoreDrill: {
status: 'passed';
backupSha256: string;
restoredAt: string;
verifiedAt: string;
isolatedDatabase: string;
};
}
export interface RehomeOptions {
mode: 'dry-run' | 'apply';
source: string;
target: string;
actor?: string;
correlationId?: string;
backupEvidence?: BackupEvidenceReport;
}
export interface RehomeReport {
mode: 'dry-run' | 'apply';
source: string;
target: string;
tables: Record<string, string>;
auditRowsAdded?: 1;
payrollLedger?: Array<{ currency: string; amountMinor: string }>;
}
export interface ParsedTenantRehomeArgs {
mode: 'dry-run' | 'apply';
source: string;
target: string;
actor?: string;
backup_evidence?: string;
json?: true;
}
export function parseTenantRehomeArgs(args: string[]): ParsedTenantRehomeArgs;
export function validateBackupEvidenceObject(evidence: unknown): BackupEvidenceReport;
export function validateBackupEvidence(filePath: string): Promise<BackupEvidenceReport>;
export function rehomeTenant(client: Client, options: RehomeOptions): Promise<RehomeReport>;