import assert from "assert"; import { RawEvent, NormalizedEvent } from "../../types"; export default (event: RawEvent): NormalizedEvent<"sentry"> => { assert(event, `Sentry:Events null event: ${event}`); assert( event.eventID, `Sentry:Events event is missing the required field eventID ${event}` ); assert( event.dateCreated, `Sentry:Events event is missing the required field dateCreated ${event}` ); // https://docs.sentry.io/api/events/get-project-events/ return { id: `sentry|${event.eventID}`, ts: Date.parse(event.dateCreated), user_info: { source_user_id: null, user_id: (event.user && event.user.id) || null, name: (event.user && event.user.name) || null, email: (event.user && event.user.email) || null, ip: (event.user && event.user.ip_address) || null, avatar: null, nickname: (event.user && event.user.username) || null, phone: null, city: null, continent_code: null, country: null, postal_code: null, region: null, timezone: null, country_code: null, address_line1: null, address_line2: null, user_agent: null, is_employee: null, title: null, birthday: null, company: { name: null, id: null, industry: null, employee_count: null, plan: null }, created_at: null, age: null, gender: null, website: null, custom_attributes: null }, text: event.title || null, href: event.org && event.groupID && event.eventID ? `https://sentry.io/organizations/${event.org}/issues/${event.groupID}/events/${event.eventID}` : null, is_bad: true, direction: null, source: "sentry", stream: "events" }; };