( initialSubtaskFiles: readonly T[], selectedSubtaskFiles: readonly T[] )
| 51 | } |
| 52 | |
| 53 | export function buildTaskEditSubtaskChangePlan<T extends TaskEditSubtaskPathLike>( |
| 54 | initialSubtaskFiles: readonly T[], |
| 55 | selectedSubtaskFiles: readonly T[] |
| 56 | ): TaskEditSubtaskChangePlan<T> { |
| 57 | const currentPaths = new Set(selectedSubtaskFiles.map((file) => file.path)); |
| 58 | const initialPaths = new Set(initialSubtaskFiles.map((file) => file.path)); |
| 59 | |
| 60 | return { |
| 61 | toRemove: initialSubtaskFiles.filter((file) => !currentPaths.has(file.path)), |
| 62 | toAdd: selectedSubtaskFiles.filter((file) => !initialPaths.has(file.path)), |
| 63 | }; |
| 64 | } |
| 65 | |
| 66 | export async function applyTaskEditSubtaskChanges< |
| 67 | TSubtask extends TaskEditSubtaskPathLike, |
no test coverage detected