{"version":3,"file":"process-api-notifications.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/processors/process-api-notifications.ts"],"names":[],"mappings":";;;AAEA,wEAA+D;AAE/D;;;;;GAKG;AACH,SAAgB,uBAAuB,CACrC,YAAuC;IAEvC,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,IAAA,qCAAgB,EAAC,aAAa,CAAC,CAAC;IAEhD,OAAO;QACL,GAAG,YAAY;QACf,EAAE,EAAE,YAAY,CAAC,EAAE;QACnB,SAAS,EAAE,aAAa,CAAC,WAAW,EAAE;QACtC,MAAM,EAAE,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM;KACxC,CAAC;AACJ,CAAC;AAZD,0DAYC","sourcesContent":["import type { NormalisedAPINotification } from '../types/notification-api/notification-api';\nimport type { INotification } from '../types/notification/notification';\nimport { shouldAutoExpire } from '../utils/should-auto-expire';\n\n/**\n * Processes API notifications to a normalized INotification shape\n *\n * @param notification - API Notification (On-Chain or Platform Notification)\n * @returns Normalized Notification\n */\nexport function processAPINotifications(\n  notification: NormalisedAPINotification,\n): INotification {\n  const createdAtDate = new Date(notification.created_at);\n  const expired = shouldAutoExpire(createdAtDate);\n\n  return {\n    ...notification,\n    id: notification.id,\n    createdAt: createdAtDate.toISOString(),\n    isRead: expired || !notification.unread,\n  };\n}\n"]}