exe-watcher 0.2.10 → 0.2.12

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.
package/dist/cli.js CHANGED
@@ -6760,6 +6760,7 @@ function nextLocalMidnight(dateString) {
6760
6760
  }
6761
6761
  function computeProgressiveBackfillStart({
6762
6762
  lastComputedDate,
6763
+ oldestCachedDate,
6763
6764
  todayStart,
6764
6765
  yesterdayEnd,
6765
6766
  backfillDays,
@@ -6767,14 +6768,21 @@ function computeProgressiveBackfillStart({
6767
6768
  progressiveChunkDays = DEFAULT_PROGRESSIVE_CHUNK_DAYS
6768
6769
  }) {
6769
6770
  const fullBackfillStart = new Date(todayStart.getTime() - backfillDays * MS_PER_DAY3);
6771
+ const neededStart = new Date(todayStart.getTime() - (coldStartHistoryDays - 1) * MS_PER_DAY3);
6770
6772
  if (!lastComputedDate) {
6771
6773
  const priorHistoryDays = Math.max(coldStartHistoryDays - 1, 0);
6772
6774
  return new Date(todayStart.getTime() - priorHistoryDays * MS_PER_DAY3);
6773
6775
  }
6774
6776
  const gapStart = nextLocalMidnight(lastComputedDate);
6775
- if (gapStart < fullBackfillStart) return fullBackfillStart;
6776
- if (yesterdayEnd.getTime() - gapStart.getTime() > progressiveChunkDays * MS_PER_DAY3) {
6777
- return new Date(yesterdayEnd.getTime() - progressiveChunkDays * MS_PER_DAY3);
6777
+ if (gapStart.getTime() <= yesterdayEnd.getTime()) {
6778
+ if (gapStart < fullBackfillStart) return fullBackfillStart;
6779
+ if (yesterdayEnd.getTime() - gapStart.getTime() > progressiveChunkDays * MS_PER_DAY3) {
6780
+ return new Date(yesterdayEnd.getTime() - progressiveChunkDays * MS_PER_DAY3);
6781
+ }
6782
+ return gapStart;
6783
+ }
6784
+ if (oldestCachedDate && neededStart.getTime() < new Date(oldestCachedDate).getTime()) {
6785
+ return neededStart < fullBackfillStart ? fullBackfillStart : neededStart;
6778
6786
  }
6779
6787
  return gapStart;
6780
6788
  }
@@ -7078,18 +7086,22 @@ program.command("status").description("Compact status output (today + week + mon
7078
7086
  const latestFresh = freshDays.length > 0 ? freshDays[freshDays.length - 1].date : null;
7079
7087
  c = { ...c, days: freshDays, lastComputedDate: latestFresh };
7080
7088
  }
7089
+ const oldestCachedDate = c.days.length > 0 ? c.days[0].date : null;
7081
7090
  const effectiveGapStart = computeProgressiveBackfillStart({
7082
7091
  lastComputedDate: c.lastComputedDate,
7092
+ oldestCachedDate,
7083
7093
  todayStart,
7084
7094
  yesterdayEnd,
7085
7095
  backfillDays: BACKFILL_DAYS,
7086
7096
  coldStartHistoryDays: selectedPeriodHistoryDays
7087
7097
  });
7088
- if (effectiveGapStart.getTime() <= yesterdayEnd.getTime()) {
7089
- const gapRange = { start: effectiveGapStart, end: yesterdayEnd };
7098
+ const gapEnd = oldestCachedDate && effectiveGapStart.getTime() < new Date(oldestCachedDate).getTime() ? new Date(new Date(oldestCachedDate).getTime() - MS_PER_DAY4) : yesterdayEnd;
7099
+ if (effectiveGapStart.getTime() <= gapEnd.getTime()) {
7100
+ const gapRange = { start: effectiveGapStart, end: gapEnd };
7090
7101
  const gapProjects = filterProjectsByName(await parseAllSessions(gapRange, "all"), opts.project, opts.exclude);
7091
7102
  const gapDays = fillMissingDays(gapRange.start, gapRange.end, aggregateProjectsIntoDays(gapProjects));
7092
- c = addNewDays(c, gapDays, yesterdayStr, { coveredThrough: yesterdayStr });
7103
+ const coveredThrough = gapEnd.getTime() >= yesterdayEnd.getTime() ? yesterdayStr : void 0;
7104
+ c = addNewDays(c, gapDays, yesterdayStr, coveredThrough ? { coveredThrough } : void 0);
7093
7105
  await saveDailyCache(c);
7094
7106
  }
7095
7107
  return c;