tokenmax-collector 0.3.1 → 0.3.2
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/collect.ts +9 -1
package/package.json
CHANGED
package/src/collect.ts
CHANGED
|
@@ -55,6 +55,9 @@ const messageOf = (error: unknown): string =>
|
|
|
55
55
|
const reportUrl = (baseUrl: string): string =>
|
|
56
56
|
`${baseUrl.replace(/\/+$/, "")}/api/report`;
|
|
57
57
|
|
|
58
|
+
const providerDay = (day: UsageDay): string =>
|
|
59
|
+
`${day.date}\u0000${day.provider}`;
|
|
60
|
+
|
|
58
61
|
function acceptedCount(body: string): number | null {
|
|
59
62
|
let payload: unknown;
|
|
60
63
|
try {
|
|
@@ -212,7 +215,12 @@ export async function collect(options: CollectOptions): Promise<CollectResult> {
|
|
|
212
215
|
};
|
|
213
216
|
const antigravity = await localDays(antigravitySource, window);
|
|
214
217
|
const devin = await localDays(devinSource, window);
|
|
215
|
-
days.
|
|
218
|
+
const covered = new Set(days.map(providerDay));
|
|
219
|
+
days.push(
|
|
220
|
+
...[...antigravity.days, ...devin.days].filter(
|
|
221
|
+
(day) => !covered.has(providerDay(day)),
|
|
222
|
+
),
|
|
223
|
+
);
|
|
216
224
|
const warnings = [...antigravity.warnings, ...devin.warnings];
|
|
217
225
|
if (days.length === 0) {
|
|
218
226
|
return { kind: "empty", warnings };
|