all.js 986 B

12345678910111213141516171819202122232425262728293031323334353637
  1. module.exports = {
  2. version: 4,
  3. name: 'messages.all',
  4. description: `List all SMS and iMessage conversations, nesting items. This may be SLOW, it is recommended you use a JSON formatter along with this.`,
  5. requiresBackup: true,
  6. // Available fields.
  7. output: {
  8. id: el => el.id,
  9. date: el => el.date,
  10. service: el => el.service,
  11. chatName: el => el.chatName,
  12. displayName: el => el.displayName,
  13. messages: el => el.messages // see messages.messages report!
  14. },
  15. // Run on a v3 lib / backup object.
  16. run (lib, { backup }) {
  17. return new Promise(async (resolve, reject) => {
  18. try {
  19. let conversations = await lib.run('messages.conversations', { backup })
  20. for (var conversation of conversations) {
  21. conversation.messages = await lib.run('messages.messages', {
  22. backup,
  23. id: conversation.id
  24. })
  25. }
  26. resolve(conversations)
  27. } catch (e) {
  28. reject(e)
  29. }
  30. })
  31. }
  32. }