export interface SourceStreams { bugsnag: "events"; canny: "boards" | "comments" | "posts" | "status_changes" | "tags" | "votes"; code: "event" | "user"; customer_io: "activities" | "customers" | "messages"; diag: "canaries"; freshpaint: "identify" | "page" | "track"; hubspot: "contacts" | "email_events" | "engagements" | "subscription_changes"; intercom: "conversation_parts" | "conversations" | "users"; mixpanel: "engage" | "raw_data"; segment: "alias" | "group" | "identify" | "page" | "screen" | "track"; sendgrid: "events"; sentry: "events"; stripe: "customers" | "events"; twilio: "messages"; } export type Source = keyof SourceStreams; export type Stream = SourceStreams[T]; export type Direction = "inbound" | "outbound" | null; export type NormalizedEvent = { id: string; ts: number; // unix milliseconds text: string | null; href: string | null; is_bad: boolean | null; direction: Direction; source: T; stream: Stream; user_info: { user_id: string | null; // User ID reported by our clients source_user_id: string | null; // User ID generated by the source of this event name: string | null; email: string | null; ip: string | null; avatar: string | null; nickname: string | null; phone: string | null; city: string | null; continent_code: string | null; country: string | null; postal_code: string | null; region: string | null; address_line1: string | null; address_line2: string | null; timezone: string | null; country_code: string | null; user_agent: string | null; is_employee: boolean | null; title: string | null; // Title of the person at their company (ex: VP Product) birthday: string | null; company: { name: string | null; id: string | null; industry: string | null; employee_count: number | null; plan: string | null; // The plan this company is on (ex: "premium", "enterprise") }; created_at: number | null; // Unix ms age: number | null; gender: string | null; website: string | null; // The user's website if they have one and you know it custom_attributes: string | null; // A stringified json blob of custom user attributes }; }; export type NormalizedEventWithMeta = NormalizedEvent & { _raw: string; _version: string; }; export type RawEvent = Record; export type Normalizer = Record< Stream, (Event: RawEvent) => NormalizedEvent >; export type NormalizerWithMeta = Record< Stream, (Event: RawEvent) => NormalizedEventWithMeta >;