ai-wrapped 1.3.4 → 1.3.5
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/package.json +1 -1
- package/src/bun/scan.ts +5 -2
package/package.json
CHANGED
package/src/bun/scan.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { normalizeSession } from "./normalizer";
|
|
|
9
9
|
import { parseFile } from "./parsers";
|
|
10
10
|
import type { Session } from "./session-schema";
|
|
11
11
|
import {
|
|
12
|
+
dailyStoreNeedsTimeZoneBackfill,
|
|
12
13
|
readDailyStore,
|
|
13
14
|
readScanState,
|
|
14
15
|
writeAggregationMeta,
|
|
@@ -30,10 +31,12 @@ export interface ScanResult {
|
|
|
30
31
|
|
|
31
32
|
export const runScan = async (options: ScanOptions = {}): Promise<ScanResult> => {
|
|
32
33
|
const aggregationTimeZone = resolveAggregationTimeZone(options.timeZone);
|
|
34
|
+
const shouldFullScan =
|
|
35
|
+
Boolean(options.fullScan) || (await dailyStoreNeedsTimeZoneBackfill(aggregationTimeZone));
|
|
33
36
|
const candidates = await discoverAll(options.sources);
|
|
34
37
|
const scanState = await readScanState();
|
|
35
38
|
|
|
36
|
-
const changed =
|
|
39
|
+
const changed = shouldFullScan
|
|
37
40
|
? candidates
|
|
38
41
|
: candidates.filter((candidate) => {
|
|
39
42
|
const state = scanState[candidate.path];
|
|
@@ -73,7 +76,7 @@ export const runScan = async (options: ScanOptions = {}): Promise<ScanResult> =>
|
|
|
73
76
|
|
|
74
77
|
await writeScanState(scanState);
|
|
75
78
|
|
|
76
|
-
if (
|
|
79
|
+
if (shouldFullScan) {
|
|
77
80
|
await writeDailyStore(aggregateSessionsByDate(sessions, { timeZone: aggregationTimeZone }));
|
|
78
81
|
await writeAggregationMeta(aggregationTimeZone);
|
|
79
82
|
} else if (sessions.length > 0) {
|