agent-messenger 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.github/workflows/ci.yml +6 -0
- package/.oxfmtrc.json +13 -1
- package/.oxlintrc.json +10 -1
- package/README.md +1 -1
- package/dist/package.json +59 -58
- package/dist/src/platforms/channeltalk/client.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/client.js +2 -2
- package/dist/src/platforms/channeltalk/client.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/message.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/channeltalk/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/ensure-auth.js.map +1 -1
- package/dist/src/platforms/channeltalk/token-extractor.d.ts +9 -23
- package/dist/src/platforms/channeltalk/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/token-extractor.js +109 -341
- package/dist/src/platforms/channeltalk/token-extractor.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/client.d.ts +1 -1
- package/dist/src/platforms/channeltalkbot/client.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/client.js +4 -4
- package/dist/src/platforms/channeltalkbot/client.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/auth.js +4 -1
- package/dist/src/platforms/channeltalkbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/shared.js.map +1 -1
- package/dist/src/platforms/discord/commands/auth.js.map +1 -1
- package/dist/src/platforms/discord/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/whoami.js.map +1 -1
- package/dist/src/platforms/discord/token-extractor.d.ts +2 -10
- package/dist/src/platforms/discord/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/discord/token-extractor.js +38 -172
- package/dist/src/platforms/discord/token-extractor.js.map +1 -1
- package/dist/src/platforms/discordbot/client.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/client.js.map +1 -1
- package/dist/src/platforms/instagram/cli.d.ts.map +1 -1
- package/dist/src/platforms/instagram/cli.js +1 -4
- package/dist/src/platforms/instagram/cli.js.map +1 -1
- package/dist/src/platforms/instagram/client.d.ts.map +1 -1
- package/dist/src/platforms/instagram/client.js +8 -7
- package/dist/src/platforms/instagram/client.js.map +1 -1
- package/dist/src/platforms/instagram/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/auth.js.map +1 -1
- package/dist/src/platforms/instagram/commands/chat.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/chat.js.map +1 -1
- package/dist/src/platforms/instagram/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/message.js.map +1 -1
- package/dist/src/platforms/instagram/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/shared.js.map +1 -1
- package/dist/src/platforms/instagram/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/instagram/credential-manager.js +1 -1
- package/dist/src/platforms/instagram/credential-manager.js.map +1 -1
- package/dist/src/platforms/instagram/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/instagram/ensure-auth.js.map +1 -1
- package/dist/src/platforms/instagram/token-extractor.d.ts +7 -19
- package/dist/src/platforms/instagram/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/instagram/token-extractor.js +44 -270
- package/dist/src/platforms/instagram/token-extractor.js.map +1 -1
- package/dist/src/platforms/instagram/types.d.ts.map +1 -1
- package/dist/src/platforms/instagram/types.js +4 -2
- package/dist/src/platforms/instagram/types.js.map +1 -1
- package/dist/src/platforms/kakaotalk/auth/kakao-login.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/auth/kakao-login.js +18 -4
- package/dist/src/platforms/kakaotalk/auth/kakao-login.js.map +1 -1
- package/dist/src/platforms/kakaotalk/client.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/client.js +3 -3
- package/dist/src/platforms/kakaotalk/client.js.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/auth.js +15 -9
- package/dist/src/platforms/kakaotalk/commands/auth.js.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/shared.js.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/connection.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/connection.js.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/crypto.js +1 -1
- package/dist/src/platforms/kakaotalk/protocol/crypto.js.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/session.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/session.js +1 -3
- package/dist/src/platforms/kakaotalk/protocol/session.js.map +1 -1
- package/dist/src/platforms/kakaotalk/token-extractor.js +5 -2
- package/dist/src/platforms/kakaotalk/token-extractor.js.map +1 -1
- package/dist/src/platforms/kakaotalk/types.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/types.js +4 -2
- package/dist/src/platforms/kakaotalk/types.js.map +1 -1
- package/dist/src/platforms/line/cli.d.ts.map +1 -1
- package/dist/src/platforms/line/cli.js +1 -4
- package/dist/src/platforms/line/cli.js.map +1 -1
- package/dist/src/platforms/line/client.d.ts.map +1 -1
- package/dist/src/platforms/line/client.js +5 -13
- package/dist/src/platforms/line/client.js.map +1 -1
- package/dist/src/platforms/line/commands/chat.d.ts.map +1 -1
- package/dist/src/platforms/line/commands/chat.js.map +1 -1
- package/dist/src/platforms/line/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/line/commands/message.js.map +1 -1
- package/dist/src/platforms/line/listener.js +1 -1
- package/dist/src/platforms/line/listener.js.map +1 -1
- package/dist/src/platforms/slack/cli.d.ts.map +1 -1
- package/dist/src/platforms/slack/cli.js.map +1 -1
- package/dist/src/platforms/slack/client-mappers.d.ts +14 -0
- package/dist/src/platforms/slack/client-mappers.d.ts.map +1 -0
- package/dist/src/platforms/slack/client-mappers.js +245 -0
- package/dist/src/platforms/slack/client-mappers.js.map +1 -0
- package/dist/src/platforms/slack/client.d.ts +0 -1
- package/dist/src/platforms/slack/client.d.ts.map +1 -1
- package/dist/src/platforms/slack/client.js +41 -455
- package/dist/src/platforms/slack/client.js.map +1 -1
- package/dist/src/platforms/slack/commands/channel.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/channel.js.map +1 -1
- package/dist/src/platforms/slack/commands/emoji.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/emoji.js +1 -3
- package/dist/src/platforms/slack/commands/emoji.js.map +1 -1
- package/dist/src/platforms/slack/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/message.js.map +1 -1
- package/dist/src/platforms/slack/commands/reminder.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/reminder.js.map +1 -1
- package/dist/src/platforms/slack/commands/user.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/user.js.map +1 -1
- package/dist/src/platforms/slack/commands/usergroup.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/usergroup.js.map +1 -1
- package/dist/src/platforms/slack/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/whoami.js.map +1 -1
- package/dist/src/platforms/slack/token-extractor.d.ts +2 -6
- package/dist/src/platforms/slack/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/slack/token-extractor.js +35 -229
- package/dist/src/platforms/slack/token-extractor.js.map +1 -1
- package/dist/src/platforms/slackbot/cli.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/cli.js +1 -1
- package/dist/src/platforms/slackbot/cli.js.map +1 -1
- package/dist/src/platforms/teams/client.d.ts.map +1 -1
- package/dist/src/platforms/teams/client.js +1 -1
- package/dist/src/platforms/teams/client.js.map +1 -1
- package/dist/src/platforms/teams/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/auth.js +4 -1
- package/dist/src/platforms/teams/commands/auth.js.map +1 -1
- package/dist/src/platforms/teams/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/whoami.js.map +1 -1
- package/dist/src/platforms/teams/token-extractor.d.ts +6 -18
- package/dist/src/platforms/teams/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/teams/token-extractor.js +71 -324
- package/dist/src/platforms/teams/token-extractor.js.map +1 -1
- package/dist/src/platforms/telegram/cli.d.ts.map +1 -1
- package/dist/src/platforms/telegram/cli.js +1 -4
- package/dist/src/platforms/telegram/cli.js.map +1 -1
- package/dist/src/platforms/telegram/client.d.ts.map +1 -1
- package/dist/src/platforms/telegram/client.js.map +1 -1
- package/dist/src/platforms/telegram/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/telegram/commands/auth.js +1 -1
- package/dist/src/platforms/telegram/commands/auth.js.map +1 -1
- package/dist/src/platforms/telegram/commands/chat.d.ts.map +1 -1
- package/dist/src/platforms/telegram/commands/chat.js.map +1 -1
- package/dist/src/platforms/telegram/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/telegram/commands/message.js.map +1 -1
- package/dist/src/platforms/telegram/commands/whoami.js +1 -1
- package/dist/src/platforms/telegram/commands/whoami.js.map +1 -1
- package/dist/src/platforms/telegram/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/telegram/credential-manager.js +6 -2
- package/dist/src/platforms/telegram/credential-manager.js.map +1 -1
- package/dist/src/platforms/telegram/my-telegram-org.js.map +1 -1
- package/dist/src/platforms/webex/cli.d.ts.map +1 -1
- package/dist/src/platforms/webex/cli.js +1 -4
- package/dist/src/platforms/webex/cli.js.map +1 -1
- package/dist/src/platforms/webex/client.d.ts.map +1 -1
- package/dist/src/platforms/webex/client.js +3 -7
- package/dist/src/platforms/webex/client.js.map +1 -1
- package/dist/src/platforms/webex/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/auth.js +1 -3
- package/dist/src/platforms/webex/commands/auth.js.map +1 -1
- package/dist/src/platforms/webex/commands/member.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/member.js +1 -3
- package/dist/src/platforms/webex/commands/member.js.map +1 -1
- package/dist/src/platforms/webex/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/message.js.map +1 -1
- package/dist/src/platforms/webex/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/webex/commands/space.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/space.js.map +1 -1
- package/dist/src/platforms/webex/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/whoami.js.map +1 -1
- package/dist/src/platforms/webex/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/webex/credential-manager.js.map +1 -1
- package/dist/src/platforms/webex/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/webex/ensure-auth.js +1 -3
- package/dist/src/platforms/webex/ensure-auth.js.map +1 -1
- package/dist/src/platforms/webex/index.d.ts +1 -1
- package/dist/src/platforms/webex/index.d.ts.map +1 -1
- package/dist/src/platforms/webex/index.js.map +1 -1
- package/dist/src/platforms/webex/markdown-to-html.js.map +1 -1
- package/dist/src/platforms/webex/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/webex/token-extractor.js +5 -14
- package/dist/src/platforms/webex/token-extractor.js.map +1 -1
- package/dist/src/platforms/wechatbot/client.d.ts.map +1 -1
- package/dist/src/platforms/wechatbot/client.js.map +1 -1
- package/dist/src/platforms/wechatbot/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/wechatbot/commands/message.js.map +1 -1
- package/dist/src/platforms/whatsapp/cli.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/cli.js +1 -4
- package/dist/src/platforms/whatsapp/cli.js.map +1 -1
- package/dist/src/platforms/whatsapp/commands/chat.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/commands/chat.js.map +1 -1
- package/dist/src/platforms/whatsapp/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/commands/message.js.map +1 -1
- package/dist/src/platforms/whatsapp/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/commands/shared.js.map +1 -1
- package/dist/src/platforms/whatsapp/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/credential-manager.js +1 -1
- package/dist/src/platforms/whatsapp/credential-manager.js.map +1 -1
- package/dist/src/platforms/whatsapp/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/ensure-auth.js.map +1 -1
- package/dist/src/platforms/whatsappbot/client.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/client.js +2 -2
- package/dist/src/platforms/whatsappbot/client.js.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/auth.js +4 -1
- package/dist/src/platforms/whatsappbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/message.js.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/shared.js.map +1 -1
- package/dist/src/shared/chromium/browsers.d.ts +7 -0
- package/dist/src/shared/chromium/browsers.d.ts.map +1 -0
- package/dist/src/shared/chromium/browsers.js +89 -0
- package/dist/src/shared/chromium/browsers.js.map +1 -0
- package/dist/src/shared/chromium/cookie-reader.d.ts +20 -0
- package/dist/src/shared/chromium/cookie-reader.d.ts.map +1 -0
- package/dist/src/shared/chromium/cookie-reader.js +99 -0
- package/dist/src/shared/chromium/cookie-reader.js.map +1 -0
- package/dist/src/shared/chromium/decryptor.d.ts +42 -0
- package/dist/src/shared/chromium/decryptor.d.ts.map +1 -0
- package/dist/src/shared/chromium/decryptor.js +205 -0
- package/dist/src/shared/chromium/decryptor.js.map +1 -0
- package/dist/src/shared/chromium/index.d.ts +6 -0
- package/dist/src/shared/chromium/index.d.ts.map +1 -0
- package/dist/src/shared/chromium/index.js +4 -0
- package/dist/src/shared/chromium/index.js.map +1 -0
- package/dist/src/shared/chromium/types.d.ts +11 -0
- package/dist/src/shared/chromium/types.d.ts.map +1 -0
- package/dist/src/shared/chromium/types.js +2 -0
- package/dist/src/shared/chromium/types.js.map +1 -0
- package/dist/src/shared/utils/derived-key-cache.d.ts +1 -1
- package/dist/src/shared/utils/derived-key-cache.d.ts.map +1 -1
- package/dist/src/shared/utils/linux-keyring.js +4 -1
- package/dist/src/shared/utils/linux-keyring.js.map +1 -1
- package/dist/src/tui/adapters/kakaotalk-adapter.d.ts.map +1 -1
- package/dist/src/tui/adapters/kakaotalk-adapter.js +6 -1
- package/dist/src/tui/adapters/kakaotalk-adapter.js.map +1 -1
- package/dist/src/tui/adapters/telegram-adapter.js +1 -1
- package/dist/src/tui/adapters/telegram-adapter.js.map +1 -1
- package/dist/src/tui/adapters/webex-adapter.js +1 -1
- package/dist/src/tui/adapters/webex-adapter.js.map +1 -1
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +112 -23
- package/dist/src/tui/app.js.map +1 -1
- package/dist/src/tui/utils.d.ts.map +1 -1
- package/dist/src/tui/utils.js +11 -13
- package/dist/src/tui/utils.js.map +1 -1
- package/dist/src/tui/views/channel-picker.d.ts.map +1 -1
- package/dist/src/tui/views/channel-picker.js.map +1 -1
- package/dist/src/tui/views/workspace-picker.d.ts.map +1 -1
- package/dist/src/tui/views/workspace-picker.js.map +1 -1
- package/docs/content/docs/cli/channeltalk.mdx +24 -22
- package/docs/content/docs/cli/channeltalkbot.mdx +7 -7
- package/docs/content/docs/cli/instagram.mdx +4 -4
- package/docs/content/docs/cli/kakaotalk.mdx +9 -8
- package/docs/content/docs/cli/line.mdx +14 -14
- package/docs/content/docs/cli/webex.mdx +19 -19
- package/docs/content/docs/cli/wechatbot.mdx +12 -11
- package/docs/content/docs/cli/whatsapp.mdx +5 -4
- package/docs/content/docs/cli/whatsappbot.mdx +11 -11
- package/docs/content/docs/index.mdx +7 -7
- package/docs/content/docs/meta.json +1 -9
- package/docs/content/docs/sdk/channeltalk.mdx +5 -6
- package/docs/content/docs/sdk/channeltalkbot.mdx +6 -12
- package/docs/content/docs/sdk/discord.mdx +36 -43
- package/docs/content/docs/sdk/instagram.mdx +18 -18
- package/docs/content/docs/sdk/kakaotalk.mdx +27 -18
- package/docs/content/docs/sdk/line.mdx +8 -13
- package/docs/content/docs/sdk/meta.json +14 -1
- package/docs/content/docs/sdk/slack.mdx +36 -42
- package/docs/content/docs/sdk/teams.mdx +2 -8
- package/docs/content/docs/sdk/webex.mdx +2 -12
- package/docs/content/docs/sdk/wechatbot.mdx +1 -5
- package/docs/content/docs/sdk/whatsapp.mdx +10 -19
- package/docs/content/docs/sdk/whatsappbot.mdx +2 -10
- package/docs/content/docs/tui.mdx +23 -23
- package/docs/src/app/page.tsx +353 -108
- package/e2e/channeltalkbot.e2e.test.ts +1 -5
- package/e2e/config.ts +6 -2
- package/package.json +59 -58
- package/scripts/prepublish.ts +1 -3
- package/skills/agent-channeltalk/SKILL.md +1 -1
- package/skills/agent-channeltalkbot/SKILL.md +1 -1
- package/skills/agent-discord/SKILL.md +1 -1
- package/skills/agent-discordbot/SKILL.md +1 -1
- package/skills/agent-instagram/SKILL.md +1 -1
- package/skills/agent-kakaotalk/SKILL.md +1 -1
- package/skills/agent-line/SKILL.md +1 -1
- package/skills/agent-slack/SKILL.md +1 -1
- package/skills/agent-slackbot/SKILL.md +1 -1
- package/skills/agent-teams/SKILL.md +1 -1
- package/skills/agent-telegram/SKILL.md +1 -1
- package/skills/agent-webex/SKILL.md +1 -1
- package/skills/agent-wechatbot/SKILL.md +1 -1
- package/skills/agent-whatsapp/SKILL.md +1 -1
- package/skills/agent-whatsappbot/SKILL.md +1 -1
- package/src/platforms/channeltalk/client.test.ts +116 -29
- package/src/platforms/channeltalk/client.ts +26 -6
- package/src/platforms/channeltalk/commands/auth.test.ts +5 -5
- package/src/platforms/channeltalk/commands/auth.ts +19 -5
- package/src/platforms/channeltalk/commands/message.test.ts +2 -6
- package/src/platforms/channeltalk/commands/message.ts +5 -1
- package/src/platforms/channeltalk/commands/snapshot.test.ts +19 -4
- package/src/platforms/channeltalk/commands/snapshot.ts +5 -1
- package/src/platforms/channeltalk/ensure-auth.test.ts +20 -17
- package/src/platforms/channeltalk/ensure-auth.ts +6 -7
- package/src/platforms/channeltalk/index.ts +0 -1
- package/src/platforms/channeltalk/token-extractor.test.ts +33 -25
- package/src/platforms/channeltalk/token-extractor.ts +120 -372
- package/src/platforms/channeltalkbot/client.test.ts +1 -3
- package/src/platforms/channeltalkbot/client.ts +39 -13
- package/src/platforms/channeltalkbot/commands/auth.test.ts +3 -1
- package/src/platforms/channeltalkbot/commands/auth.ts +4 -1
- package/src/platforms/channeltalkbot/commands/bot.test.ts +13 -5
- package/src/platforms/channeltalkbot/commands/message.test.ts +12 -6
- package/src/platforms/channeltalkbot/commands/shared.ts +6 -2
- package/src/platforms/channeltalkbot/commands/snapshot.test.ts +17 -5
- package/src/platforms/channeltalkbot/credential-manager.test.ts +1 -1
- package/src/platforms/channeltalkbot/index.test.ts +0 -2
- package/src/platforms/channeltalkbot/index.ts +0 -1
- package/src/platforms/discord/commands/auth.test.ts +6 -4
- package/src/platforms/discord/commands/auth.ts +14 -14
- package/src/platforms/discord/commands/whoami.test.ts +2 -4
- package/src/platforms/discord/commands/whoami.ts +2 -0
- package/src/platforms/discord/ensure-auth.test.ts +5 -3
- package/src/platforms/discord/index.ts +0 -1
- package/src/platforms/discord/listener.test.ts +7 -1
- package/src/platforms/discord/token-extractor.test.ts +18 -12
- package/src/platforms/discord/token-extractor.ts +46 -190
- package/src/platforms/discordbot/client.ts +1 -4
- package/src/platforms/discordbot/commands/auth.test.ts +3 -1
- package/src/platforms/discordbot/commands/channel.test.ts +3 -1
- package/src/platforms/discordbot/commands/message.test.ts +3 -1
- package/src/platforms/discordbot/commands/server.test.ts +3 -1
- package/src/platforms/discordbot/commands/snapshot.test.ts +3 -1
- package/src/platforms/discordbot/commands/thread.test.ts +3 -1
- package/src/platforms/discordbot/commands/user.test.ts +3 -1
- package/src/platforms/instagram/cli.ts +1 -4
- package/src/platforms/instagram/client.test.ts +3 -8
- package/src/platforms/instagram/client.ts +39 -34
- package/src/platforms/instagram/commands/auth.test.ts +13 -12
- package/src/platforms/instagram/commands/auth.ts +136 -71
- package/src/platforms/instagram/commands/chat.test.ts +21 -24
- package/src/platforms/instagram/commands/chat.ts +2 -0
- package/src/platforms/instagram/commands/message.test.ts +29 -24
- package/src/platforms/instagram/commands/message.ts +3 -4
- package/src/platforms/instagram/commands/shared.ts +2 -5
- package/src/platforms/instagram/commands/whoami.test.ts +4 -6
- package/src/platforms/instagram/credential-manager.ts +2 -6
- package/src/platforms/instagram/ensure-auth.test.ts +1 -4
- package/src/platforms/instagram/ensure-auth.ts +6 -3
- package/src/platforms/instagram/listener.test.ts +7 -3
- package/src/platforms/instagram/token-extractor.test.ts +4 -16
- package/src/platforms/instagram/token-extractor.ts +55 -309
- package/src/platforms/instagram/types.test.ts +2 -6
- package/src/platforms/instagram/types.ts +4 -2
- package/src/platforms/kakaotalk/auth/kakao-login.ts +30 -8
- package/src/platforms/kakaotalk/client.test.ts +37 -25
- package/src/platforms/kakaotalk/client.ts +23 -12
- package/src/platforms/kakaotalk/commands/auth.test.ts +6 -18
- package/src/platforms/kakaotalk/commands/auth.ts +101 -47
- package/src/platforms/kakaotalk/commands/chat.test.ts +8 -11
- package/src/platforms/kakaotalk/commands/message.test.ts +15 -24
- package/src/platforms/kakaotalk/commands/shared.ts +1 -0
- package/src/platforms/kakaotalk/commands/whoami.test.ts +6 -10
- package/src/platforms/kakaotalk/credential-manager.test.ts +1 -4
- package/src/platforms/kakaotalk/index.test.ts +1 -0
- package/src/platforms/kakaotalk/index.ts +0 -2
- package/src/platforms/kakaotalk/listener.test.ts +7 -1
- package/src/platforms/kakaotalk/protocol/connection.ts +4 -1
- package/src/platforms/kakaotalk/protocol/crypto.ts +1 -1
- package/src/platforms/kakaotalk/protocol/session.ts +12 -6
- package/src/platforms/kakaotalk/token-extractor.ts +5 -5
- package/src/platforms/kakaotalk/types.ts +8 -7
- package/src/platforms/line/cli.ts +1 -4
- package/src/platforms/line/client.ts +12 -20
- package/src/platforms/line/commands/auth.test.ts +2 -1
- package/src/platforms/line/commands/chat.test.ts +2 -1
- package/src/platforms/line/commands/chat.ts +1 -4
- package/src/platforms/line/commands/friend.test.ts +2 -1
- package/src/platforms/line/commands/message.test.ts +2 -1
- package/src/platforms/line/commands/message.ts +2 -9
- package/src/platforms/line/commands/whoami.test.ts +2 -1
- package/src/platforms/line/credential-manager.test.ts +1 -2
- package/src/platforms/line/index.test.ts +1 -0
- package/src/platforms/line/listener.ts +1 -1
- package/src/platforms/line/types.test.ts +1 -0
- package/src/platforms/slack/cli.ts +3 -1
- package/src/platforms/slack/client-mappers.ts +297 -0
- package/src/platforms/slack/client.test.ts +532 -17
- package/src/platforms/slack/client.ts +69 -458
- package/src/platforms/slack/commands/channel.ts +1 -4
- package/src/platforms/slack/commands/emoji.test.ts +6 -4
- package/src/platforms/slack/commands/emoji.ts +20 -22
- package/src/platforms/slack/commands/message.ts +6 -1
- package/src/platforms/slack/commands/pin.test.ts +14 -12
- package/src/platforms/slack/commands/reminder.ts +7 -6
- package/src/platforms/slack/commands/user.ts +6 -1
- package/src/platforms/slack/commands/usergroup.test.ts +3 -3
- package/src/platforms/slack/commands/usergroup.ts +10 -7
- package/src/platforms/slack/commands/whoami.test.ts +1 -1
- package/src/platforms/slack/commands/whoami.ts +2 -0
- package/src/platforms/slack/index.ts +0 -2
- package/src/platforms/slack/listener.test.ts +1 -0
- package/src/platforms/slack/token-extractor.test.ts +7 -12
- package/src/platforms/slack/token-extractor.ts +47 -255
- package/src/platforms/slackbot/cli.ts +8 -1
- package/src/platforms/slackbot/commands/auth.test.ts +3 -1
- package/src/platforms/teams/client.ts +1 -1
- package/src/platforms/teams/commands/auth.test.ts +1 -1
- package/src/platforms/teams/commands/auth.ts +4 -1
- package/src/platforms/teams/commands/whoami.test.ts +2 -4
- package/src/platforms/teams/commands/whoami.ts +2 -0
- package/src/platforms/teams/index.ts +0 -1
- package/src/platforms/teams/token-extractor.ts +82 -350
- package/src/platforms/telegram/app-config.test.ts +1 -0
- package/src/platforms/telegram/chat-utils.test.ts +5 -1
- package/src/platforms/telegram/cli.ts +2 -4
- package/src/platforms/telegram/client.test.ts +16 -3
- package/src/platforms/telegram/client.ts +14 -4
- package/src/platforms/telegram/commands/auth.test.ts +1 -0
- package/src/platforms/telegram/commands/auth.ts +3 -4
- package/src/platforms/telegram/commands/chat.test.ts +2 -5
- package/src/platforms/telegram/commands/chat.ts +1 -0
- package/src/platforms/telegram/commands/message.test.ts +2 -5
- package/src/platforms/telegram/commands/message.ts +1 -0
- package/src/platforms/telegram/commands/shared.test.ts +1 -0
- package/src/platforms/telegram/commands/whoami.test.ts +5 -7
- package/src/platforms/telegram/commands/whoami.ts +1 -1
- package/src/platforms/telegram/credential-manager.test.ts +1 -0
- package/src/platforms/telegram/credential-manager.ts +11 -2
- package/src/platforms/telegram/my-telegram-org.ts +6 -2
- package/src/platforms/telegram/types.test.ts +1 -0
- package/src/platforms/webex/app-config.test.ts +1 -0
- package/src/platforms/webex/cli.ts +1 -4
- package/src/platforms/webex/client.test.ts +4 -12
- package/src/platforms/webex/client.ts +14 -52
- package/src/platforms/webex/commands/auth.test.ts +7 -1
- package/src/platforms/webex/commands/auth.ts +12 -15
- package/src/platforms/webex/commands/member.test.ts +1 -3
- package/src/platforms/webex/commands/member.ts +14 -19
- package/src/platforms/webex/commands/message.ts +4 -15
- package/src/platforms/webex/commands/snapshot.test.ts +28 -3
- package/src/platforms/webex/commands/snapshot.ts +3 -3
- package/src/platforms/webex/commands/space.test.ts +3 -3
- package/src/platforms/webex/commands/space.ts +2 -9
- package/src/platforms/webex/commands/whoami.test.ts +12 -5
- package/src/platforms/webex/commands/whoami.ts +2 -0
- package/src/platforms/webex/credential-manager.ts +11 -2
- package/src/platforms/webex/ensure-auth.ts +1 -3
- package/src/platforms/webex/index.ts +1 -7
- package/src/platforms/webex/markdown-to-html.test.ts +6 -18
- package/src/platforms/webex/markdown-to-html.ts +8 -8
- package/src/platforms/webex/token-extractor.ts +6 -29
- package/src/platforms/wechatbot/client.test.ts +6 -2
- package/src/platforms/wechatbot/client.ts +6 -1
- package/src/platforms/wechatbot/commands/auth.test.ts +3 -7
- package/src/platforms/wechatbot/commands/message.test.ts +1 -4
- package/src/platforms/wechatbot/commands/message.ts +5 -1
- package/src/platforms/wechatbot/commands/template.test.ts +1 -4
- package/src/platforms/wechatbot/commands/user.test.ts +2 -7
- package/src/platforms/whatsapp/cli.ts +1 -4
- package/src/platforms/whatsapp/commands/auth.test.ts +19 -22
- package/src/platforms/whatsapp/commands/chat.test.ts +21 -24
- package/src/platforms/whatsapp/commands/chat.ts +2 -0
- package/src/platforms/whatsapp/commands/message.test.ts +22 -24
- package/src/platforms/whatsapp/commands/message.ts +3 -5
- package/src/platforms/whatsapp/commands/shared.ts +2 -5
- package/src/platforms/whatsapp/commands/whoami.test.ts +2 -2
- package/src/platforms/whatsapp/credential-manager.ts +2 -6
- package/src/platforms/whatsapp/ensure-auth.test.ts +1 -4
- package/src/platforms/whatsapp/ensure-auth.ts +14 -6
- package/src/platforms/whatsapp/index.ts +0 -2
- package/src/platforms/whatsappbot/client.test.ts +13 -7
- package/src/platforms/whatsappbot/client.ts +18 -4
- package/src/platforms/whatsappbot/commands/auth.ts +4 -1
- package/src/platforms/whatsappbot/commands/message.test.ts +12 -2
- package/src/platforms/whatsappbot/commands/message.ts +16 -3
- package/src/platforms/whatsappbot/commands/shared.ts +3 -1
- package/src/platforms/whatsappbot/commands/whoami.test.ts +1 -3
- package/src/platforms/whatsappbot/index.ts +0 -2
- package/src/shared/chromium/browsers.test.ts +274 -0
- package/src/shared/chromium/browsers.ts +86 -0
- package/src/shared/chromium/cookie-reader.test.ts +274 -0
- package/src/shared/chromium/cookie-reader.ts +111 -0
- package/src/shared/chromium/decryptor.test.ts +449 -0
- package/src/shared/chromium/decryptor.ts +227 -0
- package/src/shared/chromium/index.ts +11 -0
- package/src/shared/chromium/types.ts +11 -0
- package/src/shared/utils/derived-key-cache.ts +1 -1
- package/src/shared/utils/linux-keyring.ts +4 -4
- package/src/tui/adapters/kakaotalk-adapter.ts +6 -1
- package/src/tui/adapters/telegram-adapter.ts +1 -1
- package/src/tui/adapters/webex-adapter.ts +1 -1
- package/src/tui/app.ts +149 -59
- package/src/tui/utils.test.ts +144 -145
- package/src/tui/utils.ts +27 -29
- package/src/tui/views/channel-picker.ts +1 -1
- package/src/tui/views/workspace-picker.ts +1 -1
|
@@ -3,7 +3,9 @@ import { afterEach, beforeEach, describe, expect, mock, spyOn, test } from 'bun:
|
|
|
3
3
|
const originalConsoleLog = console.log
|
|
4
4
|
|
|
5
5
|
mock.module('@/shared/utils/error-handler', () => ({
|
|
6
|
-
handleError: (err: Error) => {
|
|
6
|
+
handleError: (err: Error) => {
|
|
7
|
+
throw err
|
|
8
|
+
},
|
|
7
9
|
}))
|
|
8
10
|
|
|
9
11
|
const mockGetAccount = mock(() => Promise.resolve(null))
|
|
@@ -27,7 +29,9 @@ mock.module('../credential-manager', () => ({
|
|
|
27
29
|
const mockConnect = mock(() => Promise.resolve())
|
|
28
30
|
const mockClose = mock(() => Promise.resolve())
|
|
29
31
|
const mockGetSocket = mock(() => null)
|
|
30
|
-
const mockLogin = mock(function (this: unknown) {
|
|
32
|
+
const mockLogin = mock(function (this: unknown) {
|
|
33
|
+
return Promise.resolve(this)
|
|
34
|
+
})
|
|
31
35
|
|
|
32
36
|
mock.module('../client', () => ({
|
|
33
37
|
WhatsAppClient: class {
|
|
@@ -63,9 +67,12 @@ describe('auth commands', () => {
|
|
|
63
67
|
mockConnect.mockImplementation(() => Promise.resolve())
|
|
64
68
|
mockClose.mockImplementation(() => Promise.resolve())
|
|
65
69
|
mockGetSocket.mockImplementation(() => null)
|
|
66
|
-
mockLogin.mockImplementation(function (this: unknown) {
|
|
70
|
+
mockLogin.mockImplementation(function (this: unknown) {
|
|
71
|
+
return Promise.resolve(this)
|
|
72
|
+
})
|
|
67
73
|
|
|
68
|
-
consoleLogSpy = mock((..._args: unknown[]) => {})
|
|
74
|
+
consoleLogSpy = mock((..._args: unknown[]) => {})
|
|
75
|
+
console.log = consoleLogSpy
|
|
69
76
|
processExitSpy = spyOn(process, 'exit').mockImplementation((_code?: number) => {
|
|
70
77
|
throw new Error(`process.exit(${_code})`)
|
|
71
78
|
})
|
|
@@ -146,9 +153,7 @@ describe('auth commands', () => {
|
|
|
146
153
|
test('outputs error and exits when account not found', async () => {
|
|
147
154
|
mockSetCurrent.mockImplementation(() => Promise.resolve(false))
|
|
148
155
|
|
|
149
|
-
await expect(
|
|
150
|
-
authCommand.parseAsync(['use', 'nonexistent'], { from: 'user' }),
|
|
151
|
-
).rejects.toThrow('process.exit(1)')
|
|
156
|
+
await expect(authCommand.parseAsync(['use', 'nonexistent'], { from: 'user' })).rejects.toThrow('process.exit(1)')
|
|
152
157
|
|
|
153
158
|
expect(processExitSpy).toHaveBeenCalledWith(1)
|
|
154
159
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0])
|
|
@@ -180,9 +185,7 @@ describe('auth commands', () => {
|
|
|
180
185
|
test('outputs error and exits when no account configured', async () => {
|
|
181
186
|
mockGetAccount.mockImplementation(() => Promise.resolve(null))
|
|
182
187
|
|
|
183
|
-
await expect(
|
|
184
|
-
authCommand.parseAsync(['status'], { from: 'user' }),
|
|
185
|
-
).rejects.toThrow('process.exit(1)')
|
|
188
|
+
await expect(authCommand.parseAsync(['status'], { from: 'user' })).rejects.toThrow('process.exit(1)')
|
|
186
189
|
|
|
187
190
|
expect(processExitSpy).toHaveBeenCalledWith(1)
|
|
188
191
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0])
|
|
@@ -214,9 +217,9 @@ describe('auth commands', () => {
|
|
|
214
217
|
test('outputs error for specific missing account', async () => {
|
|
215
218
|
mockGetAccount.mockImplementation(() => Promise.resolve(null))
|
|
216
219
|
|
|
217
|
-
await expect(
|
|
218
|
-
|
|
219
|
-
)
|
|
220
|
+
await expect(authCommand.parseAsync(['status', '--account', 'missing-id'], { from: 'user' })).rejects.toThrow(
|
|
221
|
+
'process.exit(1)',
|
|
222
|
+
)
|
|
220
223
|
|
|
221
224
|
expect(processExitSpy).toHaveBeenCalledWith(1)
|
|
222
225
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0])
|
|
@@ -238,9 +241,7 @@ describe('auth commands', () => {
|
|
|
238
241
|
)
|
|
239
242
|
mockRemoveAccount.mockImplementation(() => Promise.resolve(true))
|
|
240
243
|
|
|
241
|
-
await expect(
|
|
242
|
-
authCommand.parseAsync(['logout'], { from: 'user' }),
|
|
243
|
-
).rejects.toThrow('process.exit(0)')
|
|
244
|
+
await expect(authCommand.parseAsync(['logout'], { from: 'user' })).rejects.toThrow('process.exit(0)')
|
|
244
245
|
|
|
245
246
|
expect(mockRemoveAccount).toHaveBeenCalledWith('plus-12025551234')
|
|
246
247
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0])
|
|
@@ -252,9 +253,7 @@ describe('auth commands', () => {
|
|
|
252
253
|
test('outputs error and exits when no account configured', async () => {
|
|
253
254
|
mockGetAccount.mockImplementation(() => Promise.resolve(null))
|
|
254
255
|
|
|
255
|
-
await expect(
|
|
256
|
-
authCommand.parseAsync(['logout'], { from: 'user' }),
|
|
257
|
-
).rejects.toThrow('process.exit(1)')
|
|
256
|
+
await expect(authCommand.parseAsync(['logout'], { from: 'user' })).rejects.toThrow('process.exit(1)')
|
|
258
257
|
|
|
259
258
|
expect(processExitSpy).toHaveBeenCalledWith(1)
|
|
260
259
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0])
|
|
@@ -274,9 +273,7 @@ describe('auth commands', () => {
|
|
|
274
273
|
mockConnect.mockImplementation(() => Promise.reject(new Error('Connection failed')))
|
|
275
274
|
mockRemoveAccount.mockImplementation(() => Promise.resolve(true))
|
|
276
275
|
|
|
277
|
-
await expect(
|
|
278
|
-
authCommand.parseAsync(['logout'], { from: 'user' }),
|
|
279
|
-
).rejects.toThrow('process.exit(0)')
|
|
276
|
+
await expect(authCommand.parseAsync(['logout'], { from: 'user' })).rejects.toThrow('process.exit(0)')
|
|
280
277
|
|
|
281
278
|
expect(mockRemoveAccount).toHaveBeenCalledWith('plus-12025551234')
|
|
282
279
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0])
|
|
@@ -3,7 +3,9 @@ import { afterEach, beforeEach, describe, expect, mock, spyOn, test } from 'bun:
|
|
|
3
3
|
const originalConsoleLog = console.log
|
|
4
4
|
|
|
5
5
|
mock.module('@/shared/utils/error-handler', () => ({
|
|
6
|
-
handleError: (err: Error) => {
|
|
6
|
+
handleError: (err: Error) => {
|
|
7
|
+
throw err
|
|
8
|
+
},
|
|
7
9
|
}))
|
|
8
10
|
|
|
9
11
|
const mockGetAccount = mock(() =>
|
|
@@ -15,9 +17,7 @@ const mockGetAccount = mock(() =>
|
|
|
15
17
|
updated_at: '2024-01-01T00:00:00.000Z',
|
|
16
18
|
}),
|
|
17
19
|
)
|
|
18
|
-
const mockEnsureAccountPaths = mock(() =>
|
|
19
|
-
Promise.resolve({ account_dir: '/tmp/test', auth_dir: '/tmp/test/auth' }),
|
|
20
|
-
)
|
|
20
|
+
const mockEnsureAccountPaths = mock(() => Promise.resolve({ account_dir: '/tmp/test', auth_dir: '/tmp/test/auth' }))
|
|
21
21
|
|
|
22
22
|
mock.module('../credential-manager', () => ({
|
|
23
23
|
WhatsAppCredentialManager: class {
|
|
@@ -55,7 +55,9 @@ const mockClose = mock(() => Promise.resolve())
|
|
|
55
55
|
|
|
56
56
|
mock.module('../client', () => ({
|
|
57
57
|
WhatsAppClient: class {
|
|
58
|
-
login = mock(function (this: unknown) {
|
|
58
|
+
login = mock(function (this: unknown) {
|
|
59
|
+
return Promise.resolve(this)
|
|
60
|
+
})
|
|
59
61
|
connect = mockConnect
|
|
60
62
|
close = mockClose
|
|
61
63
|
listChats = mockListChats
|
|
@@ -114,7 +116,8 @@ describe('chat commands', () => {
|
|
|
114
116
|
mockConnect.mockImplementation(() => Promise.resolve())
|
|
115
117
|
mockClose.mockImplementation(() => Promise.resolve())
|
|
116
118
|
|
|
117
|
-
consoleLogSpy = mock((..._args: unknown[]) => {})
|
|
119
|
+
consoleLogSpy = mock((..._args: unknown[]) => {})
|
|
120
|
+
console.log = consoleLogSpy
|
|
118
121
|
processExitSpy = spyOn(process, 'exit').mockImplementation((_code?: number) => {
|
|
119
122
|
throw new Error(`process.exit(${_code})`)
|
|
120
123
|
})
|
|
@@ -128,9 +131,7 @@ describe('chat commands', () => {
|
|
|
128
131
|
|
|
129
132
|
describe('list', () => {
|
|
130
133
|
test('lists chats with default limit', async () => {
|
|
131
|
-
await expect(
|
|
132
|
-
chatCommand.parseAsync(['list'], { from: 'user' }),
|
|
133
|
-
).rejects.toThrow('process.exit(0)')
|
|
134
|
+
await expect(chatCommand.parseAsync(['list'], { from: 'user' })).rejects.toThrow('process.exit(0)')
|
|
134
135
|
|
|
135
136
|
expect(mockListChats).toHaveBeenCalledWith(20)
|
|
136
137
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0])
|
|
@@ -140,17 +141,17 @@ describe('chat commands', () => {
|
|
|
140
141
|
})
|
|
141
142
|
|
|
142
143
|
test('respects --limit option', async () => {
|
|
143
|
-
await expect(
|
|
144
|
-
|
|
145
|
-
)
|
|
144
|
+
await expect(chatCommand.parseAsync(['list', '--limit', '5'], { from: 'user' })).rejects.toThrow(
|
|
145
|
+
'process.exit(0)',
|
|
146
|
+
)
|
|
146
147
|
|
|
147
148
|
expect(mockListChats).toHaveBeenCalledWith(5)
|
|
148
149
|
})
|
|
149
150
|
|
|
150
151
|
test('passes account option to credential manager', async () => {
|
|
151
|
-
await expect(
|
|
152
|
-
|
|
153
|
-
)
|
|
152
|
+
await expect(chatCommand.parseAsync(['list', '--account', 'my-account'], { from: 'user' })).rejects.toThrow(
|
|
153
|
+
'process.exit(0)',
|
|
154
|
+
)
|
|
154
155
|
|
|
155
156
|
expect(mockGetAccount).toHaveBeenCalledWith('my-account')
|
|
156
157
|
})
|
|
@@ -158,9 +159,7 @@ describe('chat commands', () => {
|
|
|
158
159
|
test('exits with error when no account configured', async () => {
|
|
159
160
|
mockGetAccount.mockImplementation(() => Promise.resolve(null))
|
|
160
161
|
|
|
161
|
-
await expect(
|
|
162
|
-
chatCommand.parseAsync(['list'], { from: 'user' }),
|
|
163
|
-
).rejects.toThrow('process.exit(1)')
|
|
162
|
+
await expect(chatCommand.parseAsync(['list'], { from: 'user' })).rejects.toThrow('process.exit(1)')
|
|
164
163
|
|
|
165
164
|
expect(processExitSpy).toHaveBeenCalledWith(1)
|
|
166
165
|
})
|
|
@@ -168,9 +167,7 @@ describe('chat commands', () => {
|
|
|
168
167
|
|
|
169
168
|
describe('search', () => {
|
|
170
169
|
test('searches chats by query', async () => {
|
|
171
|
-
await expect(
|
|
172
|
-
chatCommand.parseAsync(['search', 'Bob'], { from: 'user' }),
|
|
173
|
-
).rejects.toThrow('process.exit(0)')
|
|
170
|
+
await expect(chatCommand.parseAsync(['search', 'Bob'], { from: 'user' })).rejects.toThrow('process.exit(0)')
|
|
174
171
|
|
|
175
172
|
expect(mockSearchChats).toHaveBeenCalledWith('Bob', 20)
|
|
176
173
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0])
|
|
@@ -180,9 +177,9 @@ describe('chat commands', () => {
|
|
|
180
177
|
})
|
|
181
178
|
|
|
182
179
|
test('respects --limit option', async () => {
|
|
183
|
-
await expect(
|
|
184
|
-
|
|
185
|
-
)
|
|
180
|
+
await expect(chatCommand.parseAsync(['search', 'Alice', '--limit', '3'], { from: 'user' })).rejects.toThrow(
|
|
181
|
+
'process.exit(0)',
|
|
182
|
+
)
|
|
186
183
|
|
|
187
184
|
expect(mockSearchChats).toHaveBeenCalledWith('Alice', 3)
|
|
188
185
|
})
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
|
+
|
|
2
3
|
import { handleError } from '@/shared/utils/error-handler'
|
|
3
4
|
import { formatOutput } from '@/shared/utils/output'
|
|
5
|
+
|
|
4
6
|
import { parseLimitOption, withWhatsAppClient } from './shared'
|
|
5
7
|
|
|
6
8
|
async function listAction(options: { account?: string; pretty?: boolean; limit?: string }): Promise<void> {
|
|
@@ -3,7 +3,9 @@ import { afterEach, beforeEach, describe, expect, mock, spyOn, test } from 'bun:
|
|
|
3
3
|
const originalConsoleLog = console.log
|
|
4
4
|
|
|
5
5
|
mock.module('@/shared/utils/error-handler', () => ({
|
|
6
|
-
handleError: (err: Error) => {
|
|
6
|
+
handleError: (err: Error) => {
|
|
7
|
+
throw err
|
|
8
|
+
},
|
|
7
9
|
}))
|
|
8
10
|
|
|
9
11
|
const mockGetAccount = mock(() =>
|
|
@@ -15,9 +17,7 @@ const mockGetAccount = mock(() =>
|
|
|
15
17
|
updated_at: '2024-01-01T00:00:00.000Z',
|
|
16
18
|
}),
|
|
17
19
|
)
|
|
18
|
-
const mockEnsureAccountPaths = mock(() =>
|
|
19
|
-
Promise.resolve({ account_dir: '/tmp/test', auth_dir: '/tmp/test/auth' }),
|
|
20
|
-
)
|
|
20
|
+
const mockEnsureAccountPaths = mock(() => Promise.resolve({ account_dir: '/tmp/test', auth_dir: '/tmp/test/auth' }))
|
|
21
21
|
|
|
22
22
|
mock.module('../credential-manager', () => ({
|
|
23
23
|
WhatsAppCredentialManager: class {
|
|
@@ -54,7 +54,9 @@ const mockClose = mock(() => Promise.resolve())
|
|
|
54
54
|
|
|
55
55
|
mock.module('../client', () => ({
|
|
56
56
|
WhatsAppClient: class {
|
|
57
|
-
login = mock(function (this: unknown) {
|
|
57
|
+
login = mock(function (this: unknown) {
|
|
58
|
+
return Promise.resolve(this)
|
|
59
|
+
})
|
|
58
60
|
connect = mockConnect
|
|
59
61
|
close = mockClose
|
|
60
62
|
getMessages = mockGetMessages
|
|
@@ -114,7 +116,8 @@ describe('message commands', () => {
|
|
|
114
116
|
mockConnect.mockImplementation(() => Promise.resolve())
|
|
115
117
|
mockClose.mockImplementation(() => Promise.resolve())
|
|
116
118
|
|
|
117
|
-
consoleLogSpy = mock((..._args: unknown[]) => {})
|
|
119
|
+
consoleLogSpy = mock((..._args: unknown[]) => {})
|
|
120
|
+
console.log = consoleLogSpy
|
|
118
121
|
processExitSpy = spyOn(process, 'exit').mockImplementation((_code?: number) => {
|
|
119
122
|
throw new Error(`process.exit(${_code})`)
|
|
120
123
|
})
|
|
@@ -128,9 +131,9 @@ describe('message commands', () => {
|
|
|
128
131
|
|
|
129
132
|
describe('list', () => {
|
|
130
133
|
test('fetches messages for a chat', async () => {
|
|
131
|
-
await expect(
|
|
132
|
-
|
|
133
|
-
)
|
|
134
|
+
await expect(messageCommand.parseAsync(['list', '12025551234@s.whatsapp.net'], { from: 'user' })).rejects.toThrow(
|
|
135
|
+
'process.exit(0)',
|
|
136
|
+
)
|
|
134
137
|
|
|
135
138
|
expect(mockGetMessages).toHaveBeenCalledWith('12025551234@s.whatsapp.net', 25)
|
|
136
139
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0])
|
|
@@ -158,9 +161,9 @@ describe('message commands', () => {
|
|
|
158
161
|
test('exits with error when no account configured', async () => {
|
|
159
162
|
mockGetAccount.mockImplementation(() => Promise.resolve(null))
|
|
160
163
|
|
|
161
|
-
await expect(
|
|
162
|
-
|
|
163
|
-
)
|
|
164
|
+
await expect(messageCommand.parseAsync(['list', '12025551234@s.whatsapp.net'], { from: 'user' })).rejects.toThrow(
|
|
165
|
+
'process.exit(1)',
|
|
166
|
+
)
|
|
164
167
|
|
|
165
168
|
expect(processExitSpy).toHaveBeenCalledWith(1)
|
|
166
169
|
})
|
|
@@ -192,10 +195,7 @@ describe('message commands', () => {
|
|
|
192
195
|
describe('react', () => {
|
|
193
196
|
test('sends a reaction to a message', async () => {
|
|
194
197
|
await expect(
|
|
195
|
-
messageCommand.parseAsync(
|
|
196
|
-
['react', '12025551234@s.whatsapp.net', 'msg-1', '👍'],
|
|
197
|
-
{ from: 'user' },
|
|
198
|
-
),
|
|
198
|
+
messageCommand.parseAsync(['react', '12025551234@s.whatsapp.net', 'msg-1', '👍'], { from: 'user' }),
|
|
199
199
|
).rejects.toThrow('process.exit(0)')
|
|
200
200
|
|
|
201
201
|
expect(mockSendReaction).toHaveBeenCalledWith('12025551234@s.whatsapp.net', 'msg-1', '👍', undefined)
|
|
@@ -208,10 +208,9 @@ describe('message commands', () => {
|
|
|
208
208
|
|
|
209
209
|
test('passes --from-me flag to sendReaction', async () => {
|
|
210
210
|
await expect(
|
|
211
|
-
messageCommand.parseAsync(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
),
|
|
211
|
+
messageCommand.parseAsync(['react', '12025551234@s.whatsapp.net', 'msg-1', '❤️', '--from-me'], {
|
|
212
|
+
from: 'user',
|
|
213
|
+
}),
|
|
215
214
|
).rejects.toThrow('process.exit(0)')
|
|
216
215
|
|
|
217
216
|
expect(mockSendReaction).toHaveBeenCalledWith('12025551234@s.whatsapp.net', 'msg-1', '❤️', true)
|
|
@@ -219,10 +218,9 @@ describe('message commands', () => {
|
|
|
219
218
|
|
|
220
219
|
test('passes account option to credential manager', async () => {
|
|
221
220
|
await expect(
|
|
222
|
-
messageCommand.parseAsync(
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
),
|
|
221
|
+
messageCommand.parseAsync(['react', '12025551234@s.whatsapp.net', 'msg-1', '👍', '--account', 'my-account'], {
|
|
222
|
+
from: 'user',
|
|
223
|
+
}),
|
|
226
224
|
).rejects.toThrow('process.exit(0)')
|
|
227
225
|
|
|
228
226
|
expect(mockGetAccount).toHaveBeenCalledWith('my-account')
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
|
+
|
|
2
3
|
import { handleError } from '@/shared/utils/error-handler'
|
|
3
4
|
import { formatOutput } from '@/shared/utils/output'
|
|
5
|
+
|
|
4
6
|
import { parseLimitOption, withWhatsAppClient } from './shared'
|
|
5
7
|
|
|
6
8
|
async function listAction(
|
|
@@ -17,11 +19,7 @@ async function listAction(
|
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
async function sendAction(
|
|
21
|
-
chat: string,
|
|
22
|
-
text: string,
|
|
23
|
-
options: { account?: string; pretty?: boolean },
|
|
24
|
-
): Promise<void> {
|
|
22
|
+
async function sendAction(chat: string, text: string, options: { account?: string; pretty?: boolean }): Promise<void> {
|
|
25
23
|
try {
|
|
26
24
|
const message = await withWhatsAppClient(options, (client) => client.sendMessage(chat, text))
|
|
27
25
|
console.log(formatOutput(message, options.pretty))
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { formatOutput } from '@/shared/utils/output'
|
|
2
|
+
|
|
2
3
|
import { WhatsAppClient } from '../client'
|
|
3
4
|
import { WhatsAppCredentialManager } from '../credential-manager'
|
|
4
5
|
import { WhatsAppError } from '../types'
|
|
@@ -8,11 +9,7 @@ export interface AccountOption {
|
|
|
8
9
|
pretty?: boolean
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
export function parseLimitOption(
|
|
12
|
-
rawLimit: string | undefined,
|
|
13
|
-
defaultValue: number,
|
|
14
|
-
maxValue = 100,
|
|
15
|
-
): number {
|
|
12
|
+
export function parseLimitOption(rawLimit: string | undefined, defaultValue: number, maxValue = 100): number {
|
|
16
13
|
const trimmed = (rawLimit ?? `${defaultValue}`).trim()
|
|
17
14
|
|
|
18
15
|
if (!/^\d+$/.test(trimmed)) {
|
|
@@ -21,8 +21,8 @@ describe('whoami command', () => {
|
|
|
21
21
|
phone_number: '12025551234',
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
withWhatsAppClientSpy = spyOn(sharedModule, 'withWhatsAppClient').mockImplementation(
|
|
25
|
-
|
|
24
|
+
withWhatsAppClientSpy = spyOn(sharedModule, 'withWhatsAppClient').mockImplementation(async (_opts, fn) =>
|
|
25
|
+
fn({ getProfile: () => Promise.resolve(mockProfileData) } as unknown as WhatsAppClient),
|
|
26
26
|
)
|
|
27
27
|
consoleLogSpy = spyOn(console, 'log').mockImplementation(() => {})
|
|
28
28
|
})
|
|
@@ -2,12 +2,8 @@ import { existsSync } from 'node:fs'
|
|
|
2
2
|
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises'
|
|
3
3
|
import { homedir } from 'node:os'
|
|
4
4
|
import { join } from 'node:path'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
type WhatsAppAccount,
|
|
8
|
-
type WhatsAppAccountPaths,
|
|
9
|
-
type WhatsAppConfig,
|
|
10
|
-
} from './types'
|
|
5
|
+
|
|
6
|
+
import { createAccountId, type WhatsAppAccount, type WhatsAppAccountPaths, type WhatsAppConfig } from './types'
|
|
11
7
|
|
|
12
8
|
export class WhatsAppCredentialManager {
|
|
13
9
|
private configDir: string
|
|
@@ -27,10 +27,7 @@ const validPaths = {
|
|
|
27
27
|
beforeEach(() => {
|
|
28
28
|
getAccountSpy = spyOn(WhatsAppCredentialManager.prototype, 'getAccount').mockResolvedValue(null)
|
|
29
29
|
|
|
30
|
-
getAccountPathsSpy = spyOn(
|
|
31
|
-
WhatsAppCredentialManager.prototype,
|
|
32
|
-
'getAccountPaths',
|
|
33
|
-
).mockReturnValue(validPaths)
|
|
30
|
+
getAccountPathsSpy = spyOn(WhatsAppCredentialManager.prototype, 'getAccountPaths').mockReturnValue(validPaths)
|
|
34
31
|
|
|
35
32
|
existsSyncSpy = spyOn(fs, 'existsSync').mockReturnValue(false)
|
|
36
33
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs'
|
|
2
2
|
import { join } from 'node:path'
|
|
3
|
+
|
|
3
4
|
import { formatOutput } from '@/shared/utils/output'
|
|
5
|
+
|
|
4
6
|
import { WhatsAppCredentialManager } from './credential-manager'
|
|
5
7
|
|
|
6
8
|
export async function ensureWhatsAppAuth(): Promise<void> {
|
|
@@ -8,9 +10,12 @@ export async function ensureWhatsAppAuth(): Promise<void> {
|
|
|
8
10
|
const account = await manager.getAccount()
|
|
9
11
|
|
|
10
12
|
if (!account) {
|
|
11
|
-
console.log(
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
console.log(
|
|
14
|
+
formatOutput({
|
|
15
|
+
error:
|
|
16
|
+
'Not authenticated. Run "agent-whatsapp auth login --qr" or "agent-whatsapp auth login --phone <phone-number>" first.',
|
|
17
|
+
}),
|
|
18
|
+
)
|
|
14
19
|
process.exit(1)
|
|
15
20
|
}
|
|
16
21
|
|
|
@@ -18,9 +23,12 @@ export async function ensureWhatsAppAuth(): Promise<void> {
|
|
|
18
23
|
const credsPath = join(paths.auth_dir, 'creds.json')
|
|
19
24
|
|
|
20
25
|
if (!existsSync(credsPath)) {
|
|
21
|
-
console.log(
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
console.log(
|
|
27
|
+
formatOutput({
|
|
28
|
+
error:
|
|
29
|
+
'Auth credentials missing. Run "agent-whatsapp auth login --qr" or "agent-whatsapp auth login --phone <phone-number>" to re-authenticate.',
|
|
30
|
+
}),
|
|
31
|
+
)
|
|
24
32
|
process.exit(1)
|
|
25
33
|
}
|
|
26
34
|
}
|
|
@@ -51,13 +51,21 @@ describe('WhatsAppBotClient', () => {
|
|
|
51
51
|
|
|
52
52
|
describe('login', () => {
|
|
53
53
|
test('throws on empty phoneNumberId', async () => {
|
|
54
|
-
await expect(new WhatsAppBotClient().login({ phoneNumberId: '', accessToken: 'access-token' })).rejects.toThrow(
|
|
55
|
-
|
|
54
|
+
await expect(new WhatsAppBotClient().login({ phoneNumberId: '', accessToken: 'access-token' })).rejects.toThrow(
|
|
55
|
+
WhatsAppBotError,
|
|
56
|
+
)
|
|
57
|
+
await expect(new WhatsAppBotClient().login({ phoneNumberId: '', accessToken: 'access-token' })).rejects.toThrow(
|
|
58
|
+
'Phone number ID is required',
|
|
59
|
+
)
|
|
56
60
|
})
|
|
57
61
|
|
|
58
62
|
test('throws on empty accessToken', async () => {
|
|
59
|
-
await expect(new WhatsAppBotClient().login({ phoneNumberId: 'phone-123', accessToken: '' })).rejects.toThrow(
|
|
60
|
-
|
|
63
|
+
await expect(new WhatsAppBotClient().login({ phoneNumberId: 'phone-123', accessToken: '' })).rejects.toThrow(
|
|
64
|
+
WhatsAppBotError,
|
|
65
|
+
)
|
|
66
|
+
await expect(new WhatsAppBotClient().login({ phoneNumberId: 'phone-123', accessToken: '' })).rejects.toThrow(
|
|
67
|
+
'Access token is required',
|
|
68
|
+
)
|
|
61
69
|
})
|
|
62
70
|
|
|
63
71
|
test('accepts valid phoneNumberId and accessToken', async () => {
|
|
@@ -275,9 +283,7 @@ describe('WhatsAppBotClient', () => {
|
|
|
275
283
|
describe('getTemplate', () => {
|
|
276
284
|
test('sends GET with name filter and returns first match', async () => {
|
|
277
285
|
mockResponse({
|
|
278
|
-
data: [
|
|
279
|
-
{ name: 'hello_world', status: 'APPROVED', category: 'UTILITY', language: 'en_US', components: [] },
|
|
280
|
-
],
|
|
286
|
+
data: [{ name: 'hello_world', status: 'APPROVED', category: 'UTILITY', language: 'en_US', components: [] }],
|
|
281
287
|
})
|
|
282
288
|
|
|
283
289
|
const client = await new WhatsAppBotClient().login({ phoneNumberId: 'phone-123', accessToken: 'my-token' })
|
|
@@ -101,7 +101,12 @@ export class WhatsAppBotClient {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
async listTemplates(params?: { limit?: number }): Promise<WhatsAppBotTemplate[]> {
|
|
104
|
-
return this.request<WhatsAppBotTemplate[]>(
|
|
104
|
+
return this.request<WhatsAppBotTemplate[]>(
|
|
105
|
+
'GET',
|
|
106
|
+
this.buildPath(`/${this.phoneNumberId}/message_templates`, params),
|
|
107
|
+
undefined,
|
|
108
|
+
'data',
|
|
109
|
+
)
|
|
105
110
|
}
|
|
106
111
|
|
|
107
112
|
async getTemplate(templateName: string): Promise<WhatsAppBotTemplate> {
|
|
@@ -136,7 +141,16 @@ export class WhatsAppBotClient {
|
|
|
136
141
|
const usageHeader = response.headers.get('x-business-use-case-usage')
|
|
137
142
|
if (usageHeader) {
|
|
138
143
|
try {
|
|
139
|
-
const usage = JSON.parse(usageHeader) as Record<
|
|
144
|
+
const usage = JSON.parse(usageHeader) as Record<
|
|
145
|
+
string,
|
|
146
|
+
Array<{
|
|
147
|
+
call_count: number
|
|
148
|
+
total_cputime: number
|
|
149
|
+
total_time: number
|
|
150
|
+
type: string
|
|
151
|
+
estimated_time_to_regain_access: number
|
|
152
|
+
}>
|
|
153
|
+
>
|
|
140
154
|
for (const entries of Object.values(usage)) {
|
|
141
155
|
for (const entry of entries) {
|
|
142
156
|
if (entry.call_count >= 100) {
|
|
@@ -199,7 +213,7 @@ export class WhatsAppBotClient {
|
|
|
199
213
|
continue
|
|
200
214
|
}
|
|
201
215
|
|
|
202
|
-
const errorBody = await response.json().catch(() => ({})) as {
|
|
216
|
+
const errorBody = (await response.json().catch(() => ({}))) as {
|
|
203
217
|
error?: { message?: string; code?: number }
|
|
204
218
|
}
|
|
205
219
|
const msg = errorBody.error?.message || `HTTP ${response.status}`
|
|
@@ -208,7 +222,7 @@ export class WhatsAppBotClient {
|
|
|
208
222
|
}
|
|
209
223
|
|
|
210
224
|
if (!response.ok) {
|
|
211
|
-
const errorBody = await response.json().catch(() => ({})) as {
|
|
225
|
+
const errorBody = (await response.json().catch(() => ({}))) as {
|
|
212
226
|
error?: { message?: string; code?: number }
|
|
213
227
|
}
|
|
214
228
|
const msg = errorBody.error?.message || `HTTP ${response.status}`
|
|
@@ -63,7 +63,10 @@ export async function statusAction(options: ActionOptions): Promise<ActionResult
|
|
|
63
63
|
let accountName: string | undefined
|
|
64
64
|
|
|
65
65
|
try {
|
|
66
|
-
const client = await new WhatsAppBotClient().login({
|
|
66
|
+
const client = await new WhatsAppBotClient().login({
|
|
67
|
+
phoneNumberId: creds.phone_number_id,
|
|
68
|
+
accessToken: creds.access_token,
|
|
69
|
+
})
|
|
67
70
|
const result = await client.verifyToken()
|
|
68
71
|
valid = true
|
|
69
72
|
phoneNumberId = creds.phone_number_id
|
|
@@ -174,7 +174,12 @@ describe('message commands', () => {
|
|
|
174
174
|
|
|
175
175
|
expect(result.messaging_product).toBe('whatsapp')
|
|
176
176
|
expect(result.messages?.[0].id).toBe('wamid.doc123')
|
|
177
|
-
expect(mockSendDocumentMessage).toHaveBeenCalledWith(
|
|
177
|
+
expect(mockSendDocumentMessage).toHaveBeenCalledWith(
|
|
178
|
+
'+1234567890',
|
|
179
|
+
'https://example.com/doc.pdf',
|
|
180
|
+
undefined,
|
|
181
|
+
undefined,
|
|
182
|
+
)
|
|
178
183
|
})
|
|
179
184
|
|
|
180
185
|
test('passes filename and caption when provided', async () => {
|
|
@@ -183,7 +188,12 @@ describe('message commands', () => {
|
|
|
183
188
|
caption: 'Monthly report',
|
|
184
189
|
})
|
|
185
190
|
|
|
186
|
-
expect(mockSendDocumentMessage).toHaveBeenCalledWith(
|
|
191
|
+
expect(mockSendDocumentMessage).toHaveBeenCalledWith(
|
|
192
|
+
'+1234567890',
|
|
193
|
+
'https://example.com/doc.pdf',
|
|
194
|
+
'report.pdf',
|
|
195
|
+
'Monthly report',
|
|
196
|
+
)
|
|
187
197
|
expect(result.error).toBeUndefined()
|
|
188
198
|
})
|
|
189
199
|
|
|
@@ -29,7 +29,11 @@ export async function sendAction(to: string, text: string, options: MessageOptio
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export async function sendTemplateAction(
|
|
32
|
+
export async function sendTemplateAction(
|
|
33
|
+
to: string,
|
|
34
|
+
templateName: string,
|
|
35
|
+
options: MessageOptions,
|
|
36
|
+
): Promise<MessageResult> {
|
|
33
37
|
try {
|
|
34
38
|
const client = await getClient(options)
|
|
35
39
|
const languageCode = options.language ?? 'en_US'
|
|
@@ -48,7 +52,12 @@ export async function sendTemplateAction(to: string, templateName: string, optio
|
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
export async function sendReactionAction(
|
|
55
|
+
export async function sendReactionAction(
|
|
56
|
+
to: string,
|
|
57
|
+
messageId: string,
|
|
58
|
+
emoji: string,
|
|
59
|
+
options: MessageOptions,
|
|
60
|
+
): Promise<MessageResult> {
|
|
52
61
|
try {
|
|
53
62
|
const client = await getClient(options)
|
|
54
63
|
const response = await client.sendReaction(to, messageId, emoji)
|
|
@@ -68,7 +77,11 @@ export async function sendImageAction(to: string, imageUrl: string, options: Mes
|
|
|
68
77
|
}
|
|
69
78
|
}
|
|
70
79
|
|
|
71
|
-
export async function sendDocumentAction(
|
|
80
|
+
export async function sendDocumentAction(
|
|
81
|
+
to: string,
|
|
82
|
+
documentUrl: string,
|
|
83
|
+
options: MessageOptions,
|
|
84
|
+
): Promise<MessageResult> {
|
|
72
85
|
try {
|
|
73
86
|
const client = await getClient(options)
|
|
74
87
|
const response = await client.sendDocumentMessage(to, documentUrl, options.filename, options.caption)
|
|
@@ -14,7 +14,9 @@ export async function getClient(options: AccountOption): Promise<WhatsAppBotClie
|
|
|
14
14
|
const creds = await credManager.getCredentials(options.account)
|
|
15
15
|
|
|
16
16
|
if (!creds) {
|
|
17
|
-
console.log(
|
|
17
|
+
console.log(
|
|
18
|
+
formatOutput({ error: 'No credentials. Run "auth set <phone-number-id> <access-token>" first.' }, options.pretty),
|
|
19
|
+
)
|
|
18
20
|
process.exit(1)
|
|
19
21
|
}
|
|
20
22
|
|
|
@@ -4,9 +4,7 @@ import { mkdir } from 'node:fs/promises'
|
|
|
4
4
|
import { tmpdir } from 'node:os'
|
|
5
5
|
import { join } from 'node:path'
|
|
6
6
|
|
|
7
|
-
const mockVerifyToken = mock(() =>
|
|
8
|
-
Promise.resolve({ verified_name: 'Test Business' }),
|
|
9
|
-
)
|
|
7
|
+
const mockVerifyToken = mock(() => Promise.resolve({ verified_name: 'Test Business' }))
|
|
10
8
|
|
|
11
9
|
mock.module('../client', () => ({
|
|
12
10
|
WhatsAppBotClient: class MockWhatsAppBotClient {
|