clientreport.js 645 B

12345678910111213141516171819202122232425
  1. import { createEnvelope } from './envelope.js';
  2. import { dateTimestampInSeconds } from './time.js';
  3. /**
  4. * Creates client report envelope
  5. * @param discarded_events An array of discard events
  6. * @param dsn A DSN that can be set on the header. Optional.
  7. */
  8. function createClientReportEnvelope(
  9. discarded_events,
  10. dsn,
  11. timestamp,
  12. ) {
  13. const clientReportItem = [
  14. { type: 'client_report' },
  15. {
  16. timestamp: timestamp || dateTimestampInSeconds(),
  17. discarded_events,
  18. },
  19. ];
  20. return createEnvelope(dsn ? { dsn } : {}, [clientReportItem]);
  21. }
  22. export { createClientReportEnvelope };
  23. //# sourceMappingURL=clientreport.js.map