openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
2 lines • 919 B
JavaScript
//!src/commands/doctor-migration-backup-names.ts
const PREFIX=`.pre-startup-migration-`;const RESTART_RECOVERY=`restart-recovery-`;const NAME_PATTERN=/^(restart-recovery-)?[a-f0-9-]{36}(\.scoped|\.postgres)?\.bak$/;const NAMES={full:e=>`${e}.bak`,scoped:e=>`${e}.scoped.bak`,postgres:e=>`${e}.postgres.bak`,"restart-recovery":e=>`${RESTART_RECOVERY}${e}.bak`};function doctorMigrationBackupPath(e,t,n){return`${e}${PREFIX}${NAMES[n](t)}`}function classifyDoctorMigrationBackupPath(e,t){const n=`${e}${PREFIX}`;if(!t.startsWith(n))return;const r=NAME_PATTERN.exec(t.slice(n.length));if(!r)return;if(r[1])return r[2]?void 0:`restart-recovery`;return r[2]===`.scoped`?`scoped`:r[2]===`.postgres`?`postgres`:`full`}function isDoctorMigrationBackupPath(e,t){return classifyDoctorMigrationBackupPath(e,t)!==void 0}export{doctorMigrationBackupPath as n,isDoctorMigrationBackupPath as r,classifyDoctorMigrationBackupPath as t};