feat(analytics-gateway): Add support for batch event tracking in the analytics gateway client

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Claude Code 2026-03-19 08:10:21 -07:00
parent 1606646742
commit ed8eb08c4c

View file

@ -175,11 +175,12 @@ export class AnalyticsApiClient implements OnModuleInit {
private async fetchJson<T>(path: string, params?: Record<string, string>): Promise<T> {
const url = new URL(path, this.baseUrl);
if (params) {
for (const [key, value] of Object.entries(params)) {
if (value !== undefined) {
url.searchParams.set(key, value);
}
const endDate = params?.endDate ?? new Date().toISOString().split('T')[0];
const startDate = params?.startDate ?? new Date(Date.now() - 30 * 24 * 60 * 60 * 1000).toISOString().split('T')[0];
const merged: Record<string, string> = { startDate, endDate, ...params };
for (const [key, value] of Object.entries(merged)) {
if (value !== undefined) {
url.searchParams.set(key, value);
}
}