@omercnet/paseo-omp 1.3.3-next.232.1 → 1.3.3-next.238.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omercnet/paseo-omp",
3
- "version": "1.3.3-next.232.1",
3
+ "version": "1.3.3-next.238.1",
4
4
  "type": "module",
5
5
  "description": "Paseo integration for OMP, including its direct provider and workspace tooling.",
6
6
  "license": "MIT",
@@ -1,2 +1,2 @@
1
1
  /** Release Please keeps this bundle-safe constant aligned with package.json. */
2
- export const PASEO_OMP_PACKAGE_VERSION = "1.3.3-next.232.1"; // x-release-please-version
2
+ export const PASEO_OMP_PACKAGE_VERSION = "1.3.3-next.238.1"; // x-release-please-version
package/server/quota.ts CHANGED
@@ -15,7 +15,12 @@ const QuotaRowSchema = z.object({
15
15
  recordedAt: z.number().int(),
16
16
  });
17
17
 
18
- export function listOmpQuotasFrom(path: string): OmpQuota[] {
18
+ // Reset-less rows (no resets_at) refresh on every OMP poll, so one this old is an inactive provider.
19
+ const ABANDONED_AFTER_MS = 30 * 86_400_000;
20
+
21
+ // Only live windows are returned: a series whose newest row already reset (or never resets and was
22
+ // abandoned) would otherwise pin the pill at its last exhausted value and bloat the popover.
23
+ export function listOmpQuotasFrom(path: string, now = Date.now()): OmpQuota[] {
19
24
  try {
20
25
  const database = new DatabaseSync(path, { readOnly: true, timeout: 500 });
21
26
  try {
@@ -33,9 +38,10 @@ export function listOmpQuotasFrom(path: string): OmpQuota[] {
33
38
  FROM usage_history
34
39
  )
35
40
  WHERE position = 1
41
+ AND (resets_at > ? OR (resets_at IS NULL AND recorded_at > ?))
36
42
  ORDER BY COALESCE(usedFraction, -1) DESC, provider, label`,
37
43
  )
38
- .all();
44
+ .all(now, now - ABANDONED_AFTER_MS);
39
45
  return rows.flatMap((row) => {
40
46
  const parsed = QuotaRowSchema.safeParse(row);
41
47
  return parsed.success ? [parsed.data] : [];