import assert from "assert"; import { RawEvent, NormalizedEvent } from "../../types"; export default (event: RawEvent): NormalizedEvent<"hubspot"> => { assert(event, `Hubspot:subscription_changes null event: ${event}`); assert( event.timestamp, `Hubspot:subscription_changes event is missing the required field timestamp ${event}` ); const id = `${event.recipient}:${event.portalId}:${event.timestamp}`; return { id: `hubspot|${id}`, ts: Date.parse(event.timestamp), user_info: { source_user_id: null, user_id: null, name: null, email: 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, ip: null, avatar: null, nickname: null, phone: null, city: null, country: null, postal_code: null, region: null, address_line1: null, continent_code: null, address_line2: null, country_code: null, timezone: null, user_agent: null, is_employee: null, custom_attributes: null }, text: (event.engagement && event.engagement.type) || null, href: null, is_bad: false, direction: null, source: "hubspot", stream: "subscription_changes" }; };