🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Derive Simple Analytics event type from Zod schema
Edward Cuice4122397de4
diff --git a/server/src/services/import/mappings/simpleAnalytics.ts b/server/src/services/import/mappings/simpleAnalytics.tsindex 1e29a06d2..3d910b6b0 100644--- a/server/src/services/import/mappings/simpleAnalytics.ts+++ b/server/src/services/import/mappings/simpleAnalytics.ts@@ -7,22 +7,7 @@ import { DateTime } from "luxon";import { getDeviceType } from "../../../utils.js";import { deriveKeyOnlySchema } from "./utils.js";-export interface SimpleAnalyticsEvent {- added_iso: string;- country_code: string;- datapoint: string;- document_referrer: string;- hostname: string;- lang_language: string;- lang_region: string;- path: string;- query: string;- screen_height: string;- screen_width: string;- session_id: string;- user_agent: string;- uuid: string;-}+export type SimpleAnalyticsEvent = z.input<typeof SimpleAnalyticsImportMapper.simpleAnalyticsEventKeyOnlySchema>;export class SimpleAnalyticsImportMapper {private static readonly simpleAnalyticsEventSchema = z.object({diff --git a/server/src/services/import/mappings/umami.ts b/server/src/services/import/mappings/umami.tsindex 49daf4d2a..0746cdeba 100644--- a/server/src/services/import/mappings/umami.ts+++ b/server/src/services/import/mappings/umami.ts@@ -4,7 +4,7 @@ import { RybbitEvent } from "./rybbit.js";import { z } from "zod";import { deriveKeyOnlySchema } from "./utils.js";-export type UmamiEvent = z.input<typeof UmamiImportMapper.umamiEventSchema>;+export type UmamiEvent = z.input<typeof UmamiImportMapper.umamiEventKeyOnlySchema>;export class UmamiImportMapper {private static readonly browserMap: Record<string, string> = {@@ -67,7 +67,7 @@ export class UmamiImportMapper {return UmamiImportMapper.deviceMap[key] ?? device;});- static readonly umamiEventSchema = z.object({+ private static readonly umamiEventSchema = z.object({session_id: z.string().uuid(),hostname: z.string().max(253),