trekoon 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -93,6 +93,8 @@ interface SnapshotDeltaSelection {
93
93
  readonly taskIds?: readonly string[];
94
94
  readonly subtaskIds?: readonly string[];
95
95
  readonly dependencyIds?: readonly string[];
96
+ readonly deletedEpicIds?: readonly string[];
97
+ readonly deletedTaskIds?: readonly string[];
96
98
  readonly deletedSubtaskIds?: readonly string[];
97
99
  readonly deletedDependencyIds?: readonly string[];
98
100
  }
@@ -253,6 +255,8 @@ export function buildBoardSnapshotDelta(domain: TrackerDomain, selection: Snapsh
253
255
  tasks: snapshotTasks.filter((task) => requestedTaskIds.includes(task.id)),
254
256
  subtasks: allSubtasks.map((subtask) => mapSnapshotSubtask(subtask, indexes)).filter((subtask) => requestedSubtaskIds.includes(subtask.id)),
255
257
  dependencies: indexes.dependencies.filter((dependency) => requestedDependencyIds.has(dependency.id)),
258
+ deletedEpicIds: [...(selection.deletedEpicIds ?? [])],
259
+ deletedTaskIds: [...(selection.deletedTaskIds ?? [])],
256
260
  deletedSubtaskIds: [...(selection.deletedSubtaskIds ?? [])],
257
261
  deletedDependencyIds: [...(selection.deletedDependencyIds ?? [])],
258
262
  };
@@ -265,22 +269,8 @@ export function buildBoardSnapshot(domain: TrackerDomain): BoardSnapshot {
265
269
  const subtasks = domain.listSubtasks();
266
270
  const sourceIds = [...tasks.map((task) => task.id), ...subtasks.map((subtask) => subtask.id)];
267
271
  const dependenciesBySourceId = domain.listDependenciesBySourceIds(sourceIds);
268
- const subtasksByTaskId = new Map<string, SubtaskRecord[]>();
269
- const tasksByEpicId = new Map<string, TaskRecord[]>();
270
272
  const indexes = buildDependencyIndexes(dependenciesBySourceId, sourceIds);
271
273
 
272
- for (const task of tasks) {
273
- const existing = tasksByEpicId.get(task.epicId) ?? [];
274
- existing.push(task);
275
- tasksByEpicId.set(task.epicId, existing);
276
- }
277
-
278
- for (const subtask of subtasks) {
279
- const existing = subtasksByTaskId.get(subtask.taskId) ?? [];
280
- existing.push(subtask);
281
- subtasksByTaskId.set(subtask.taskId, existing);
282
- }
283
-
284
274
  const snapshotSubtasks: BoardSnapshotSubtask[] = subtasks.map((subtask) => mapSnapshotSubtask(subtask, indexes));
285
275
  const snapshotSubtasksByTaskId = new Map<string, BoardSnapshotSubtask[]>();
286
276
  for (const subtask of snapshotSubtasks) {
@@ -290,14 +280,14 @@ export function buildBoardSnapshot(domain: TrackerDomain): BoardSnapshot {
290
280
  }
291
281
 
292
282
  const snapshotTasks: BoardSnapshotTask[] = tasks.map((task) => mapSnapshotTask(task, snapshotSubtasksByTaskId.get(task.id) ?? [], indexes));
293
- const taskSearchTextByEpicId = new Map<string, string[]>();
283
+ const snapshotTasksByEpicId = new Map<string, BoardSnapshotTask[]>();
294
284
  for (const task of snapshotTasks) {
295
- const existing = taskSearchTextByEpicId.get(task.epicId) ?? [];
296
- existing.push(task.searchText);
297
- taskSearchTextByEpicId.set(task.epicId, existing);
285
+ const existing = snapshotTasksByEpicId.get(task.epicId) ?? [];
286
+ existing.push(task);
287
+ snapshotTasksByEpicId.set(task.epicId, existing);
298
288
  }
299
289
 
300
- const snapshotEpics: BoardSnapshotEpic[] = epics.map((epic) => mapSnapshotEpic(epic, snapshotTasks.filter((task) => task.epicId === epic.id)));
290
+ const snapshotEpics: BoardSnapshotEpic[] = epics.map((epic) => mapSnapshotEpic(epic, snapshotTasksByEpicId.get(epic.id) ?? []));
301
291
 
302
292
  return {
303
293
  generatedAt,