just the currents, never the identities
at main 74 lines 1.4 kB view raw
1/** 2 * Analytics event types and shared interfaces for Driftline Analytics 3 */ 4 5export type EventType = "account" | "view" | "action"; 6export type Environment = "dev" | "prod"; 7 8export type AnalyticsEvent = { 9 v: 1; 10 appView: string; 11 env: Environment; 12 ts: string; 13 uid: string; 14 type: EventType; 15 name: string; 16 screen?: string; 17 props?: Record<string, unknown>; 18}; 19 20export type CollectRequest = AnalyticsEvent | { events: AnalyticsEvent[] }; 21 22export type CollectResponse = { 23 success: boolean; 24 count: number; 25}; 26 27export type StatsResponse = { 28 appView: string; 29 env: Environment; 30 totalAccounts: number; 31 totalUsers: number; 32 totalEvents: number; 33 eventsByType: Record<EventType, number>; 34 topScreens: Array<{ screen: string; count: number }>; 35 topActions: Array<{ name: string; count: number }>; 36}; 37 38export type AccountsResponse = { 39 appView: string; 40 env: Environment; 41 count: number; 42}; 43 44export type UsersResponse = { 45 appView: string; 46 env: Environment; 47 count: number; 48}; 49 50export type EventsResponse = { 51 appView: string; 52 env: Environment; 53 byType: Record<EventType, number>; 54 byName: Record<string, number>; 55}; 56 57export type ApiKeyRecord = { 58 id: number; 59 app_view: string; 60 api_key: string; 61 created: string; 62}; 63 64export type EventRecord = { 65 id: number; 66 ts: string; 67 app_view: string; 68 env: string; 69 type: string; 70 name: string; 71 uid: string; 72 screen: string | null; 73 props: string | null; 74};