openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
22 lines (21 loc) • 1.03 kB
JavaScript
import { b as uniqueStrings } from "./string-normalization-DLmfYZXI.mjs";
import { d as markMigrationItemSkipped, v as summarizeMigrationItems } from "./migration-C73lp9ea.mjs";
//#region src/commands/migrate/item-selection.ts
const MIGRATION_NOT_SELECTED_REASON = "not selected for migration";
/** Applies an exact item-id selection to planned/conflicting migration items. */
function applyMigrationItemSelection(e, t) {
if (t === void 0) return e;
const n = e.items.filter((e) => e.status === "planned" || e.status === "conflict");
const r = new Set(n.map((e) => e.id));
const i = uniqueStrings(t).filter((e) => !r.has(e));
if (i.length > 0) throw new Error(`Unknown or unavailable migration item ids: ${i.map((e) => `"${e}"`).join(", ")}.`);
const a = new Set(t);
const o = e.items.map((e) => r.has(e.id) && !a.has(e.id) ? markMigrationItemSkipped(e, MIGRATION_NOT_SELECTED_REASON) : e);
return {
...e,
items: o,
summary: summarizeMigrationItems(o)
};
}
//#endregion
export { applyMigrationItemSelection as t };