clientreport.js 727 B

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