Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Derive Umami event type from Zod schema

Edward Cuidf9c87ea1b1a
diff --git a/server/src/services/import/mappings/umami.ts b/server/src/services/import/mappings/umami.ts
index 33114f27e..49daf4d2a 100644
--- a/server/src/services/import/mappings/umami.ts
+++ b/server/src/services/import/mappings/umami.ts
@@ -4,27 +4,7 @@ import { RybbitEvent } from "./rybbit.js";
import { z } from "zod";
import { deriveKeyOnlySchema } from "./utils.js";
-export interface UmamiEvent {
- session_id: string;
- hostname: string;
- browser: string;
- os: string;
- device: string;
- screen: string;
- language: string;
- country: string;
- region: string;
- city: string;
- url_path: string;
- url_query: string;
- referrer_path: string;
- referrer_domain: string;
- page_title: string;
- event_type: string;
- event_name: string;
- distinct_id: string;
- created_at: string;
-}
+export type UmamiEvent = z.input<typeof UmamiImportMapper.umamiEventSchema>;
export class UmamiImportMapper {
private static readonly browserMap: Record<string, string> = {
@@ -87,7 +67,7 @@ export class UmamiImportMapper {
return UmamiImportMapper.deviceMap[key] ?? device;
});
- private static readonly umamiEventSchema = z.object({
+ static readonly umamiEventSchema = z.object({
session_id: z.string().uuid(),
hostname: z.string().max(253),