feat(api): expose app version in /api/v1/stats

Add version to StatsResponse and getStats so the canonical public
monitoring endpoint reports the running build alongside the footer
and /health.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Julien Herr
2026-05-25 15:50:45 +02:00
parent e86beeeb8a
commit 82a4bd8341
5 changed files with 9 additions and 1 deletions
+2
View File
@@ -1,4 +1,5 @@
import { Counters, Env, StatsResponse } from "../types";
import { APP_VERSION } from "../config/version";
import { logger } from "../infrastructure/logger";
import { FeedRepository } from "../infrastructure/feed-repository";
import { CountersRepository } from "../infrastructure/counters-repository";
@@ -77,6 +78,7 @@ export async function getStats(env: Env): Promise<StatsResponse> {
active_feeds: feeds.length,
websub_subscriptions_active: websubCount,
attachments_enabled: !!getAttachmentBucket(env),
version: APP_VERSION,
};
}
+2
View File
@@ -295,10 +295,12 @@ describe("REST API (/api/v1)", () => {
feeds_created: number;
active_feeds: number;
attachments_enabled: boolean;
version: string;
};
expect(stats.feeds_created).toBeGreaterThanOrEqual(1);
expect(stats.active_feeds).toBeGreaterThanOrEqual(1);
expect(typeof stats.attachments_enabled).toBe("boolean");
expect(stats.version).toMatch(/^\d+\.\d+\.\d+/);
});
});
+3
View File
@@ -154,6 +154,9 @@ export const StatsSchema = z
active_feeds: z.number(),
websub_subscriptions_active: z.number(),
attachments_enabled: z.boolean(),
version: z.string().openapi({
description: "Running app version (package.json), inlined at build time.",
}),
last_email_at: z.string().optional(),
last_feed_created_at: z.string().optional(),
first_seen: z.string().optional(),
+1
View File
@@ -125,6 +125,7 @@ export interface StatsResponse extends Counters {
active_feeds: number;
websub_subscriptions_active: number;
attachments_enabled: boolean;
version: string; // Running app version (package.json), inlined at build time
}
// WebSub (PubSubHubbub) subscription configuration