diff --git a/packages/event-producer/package.json b/packages/event-producer/package.json index ce0c91b2..eec9ebb1 100644 --- a/packages/event-producer/package.json +++ b/packages/event-producer/package.json @@ -1,6 +1,6 @@ { "name": "@tidal-music/event-producer", - "version": "2.1.0", + "version": "2.2.0", "type": "module", "files": [ "dist" diff --git a/packages/event-producer/src/monitor/index.ts b/packages/event-producer/src/monitor/index.ts index 12140fc1..bd891e6c 100644 --- a/packages/event-producer/src/monitor/index.ts +++ b/packages/event-producer/src/monitor/index.ts @@ -75,7 +75,7 @@ export const sendMonitoringInfo = async () => { consentCategory: 'NECESSARY', credentials: await config.credentialsProvider?.getCredentials(), platformData: config.platform, - sentTimestamp: trueTime.now().toString(), + sentTimestamp: trueTime.now(), }), id: uuid(), name: 'tep-tl-monitoring', diff --git a/packages/event-producer/src/send/send.test.ts b/packages/event-producer/src/send/send.test.ts index 93b4dd80..22f192d4 100644 --- a/packages/event-producer/src/send/send.test.ts +++ b/packages/event-producer/src/send/send.test.ts @@ -33,7 +33,7 @@ describe.sequential('sendEvent', () => { expect.objectContaining({ payload: JSON.stringify({ ...eventWithoutConsentCategory, - ts: '1337', + ts: 1337, uuid: 'fakeUuid', }), }), diff --git a/packages/event-producer/src/send/send.ts b/packages/event-producer/src/send/send.ts index a20f6a5a..1ff43fcd 100644 --- a/packages/event-producer/src/send/send.ts +++ b/packages/event-producer/src/send/send.ts @@ -12,7 +12,7 @@ import { uuid } from '../uuid/uuid'; type CreatePayloadParams = { event: SentEvent; id: string; - ts: string; + ts: number; }; /** * Creates a payload to be sent to backend. The payload is the whole raw event with uuid @@ -40,7 +40,7 @@ const createEvent = async ({ event, }: SendEventParams): Promise => { const id = uuid(); - const sentTimestamp = trueTime.now().toString(); + const sentTimestamp = trueTime.now(); const headers = getEventHeaders({ appInfo: config.appInfo, consentCategory: event.consentCategory, diff --git a/packages/event-producer/src/types.ts b/packages/event-producer/src/types.ts index 94ad70dc..ad95fc81 100644 --- a/packages/event-producer/src/types.ts +++ b/packages/event-producer/src/types.ts @@ -8,7 +8,7 @@ export type AppInfo = { appVersion: string; }; -export type EventHeaders = Record; +export type EventHeaders = Record; /** * This is an incoming raw event. diff --git a/packages/event-producer/src/utils/headerUtils.test.ts b/packages/event-producer/src/utils/headerUtils.test.ts index 7fa0d7eb..58fab983 100644 --- a/packages/event-producer/src/utils/headerUtils.test.ts +++ b/packages/event-producer/src/utils/headerUtils.test.ts @@ -12,7 +12,7 @@ describe('headerUtils', () => { consentCategory: 'NECESSARY', credentials: credentials1, platformData: config.platform, - sentTimestamp: '2023', + sentTimestamp: 2023, suppliedHeaders: { someXtraHeader: 'eggs', }, @@ -26,7 +26,7 @@ describe('headerUtils', () => { 'client-id': 'fakeClientId', 'consent-category': 'NECESSARY', 'os-name': config.platform.osName, - 'requested-sent-timestamp': '2023', + 'requested-sent-timestamp': 2023, someXtraHeader: 'eggs', }); }); @@ -37,7 +37,7 @@ describe('headerUtils', () => { consentCategory: 'NECESSARY', credentials: credentials1, platformData: config.platform, - sentTimestamp: '2023', + sentTimestamp: 2023, suppliedHeaders: { 'app-name': 'bacon', someXtraHeader: 'eggs', diff --git a/packages/event-producer/src/utils/headerUtils.ts b/packages/event-producer/src/utils/headerUtils.ts index cae5fe6e..1f35d1c1 100644 --- a/packages/event-producer/src/utils/headerUtils.ts +++ b/packages/event-producer/src/utils/headerUtils.ts @@ -17,8 +17,8 @@ export const getEventHeaders = ({ consentCategory: ConsentCategory; credentials?: Credentials; platformData: PlatformData; - sentTimestamp: string; - suppliedHeaders?: Record; + sentTimestamp: number; + suppliedHeaders?: Record; }) => { const accessToken = credentials?.token; const clientId = credentials?.clientId ?? 'clientIDMissing!';