calls.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. module.exports.name = 'calls'
  2. module.exports.description = 'List all call records contained in the backup.'
  3. // Specify this reporter requires a backup.
  4. // The second parameter to func() is now a backup instead of the path to one.
  5. module.exports.requiresBackup = true
  6. // Specify this reporter supports the promises API for allowing chaining of reports.
  7. module.exports.usesPromises = true
  8. // Specify this only works for iOS 10+
  9. module.exports.supportedVersions = '>=10.0'
  10. module.exports.func = function (program, backup, resolve, reject) {
  11. backup.getCallsList()
  12. .then((items) => {
  13. // Use the configured formatter to print the rows.
  14. const result = program.formatter.format(items, {
  15. // Color formatting?
  16. program: program,
  17. // Columns to be displayed in human-readable printouts.
  18. // Some formatters, like raw or CSV, ignore these.
  19. columns: {
  20. 'ID': el => el.Z_PK,
  21. 'Date': el => el.XFORMATTEDDATESTRING,
  22. 'Answered': el => el.ZANSWERED + '',
  23. 'Originated': el => el.ZORIGINATED + '',
  24. 'Call Type': el => el.ZCALLTYPE + '',
  25. 'Duration': el => el.ZDURATION + '',
  26. 'Location': el => el.ZLOCATION + '',
  27. 'Country': el => el.ZISO_COUNTRY_CODE + '',
  28. 'Service': el => el.ZSERVICE_PROVIDER + '',
  29. 'Address': el => (el.ZADDRESS || '').toString()
  30. }
  31. })
  32. // If using promises, we must call resolve()
  33. resolve(result)
  34. })
  35. .catch(reject)
  36. }