@raevon/n8n-nodes-whatsapp 1.0.13 → 1.0.14

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.
@@ -1,8 +1,18 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.WhatsAppConnect = void 0;
4
7
  const n8n_workflow_1 = require("n8n-workflow");
5
8
  const WhatsAppApiHelper_1 = require("./WhatsAppApiHelper");
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const node_path_1 = __importDefault(require("node:path"));
11
+ function expandHome(p) {
12
+ if (!p.startsWith('~'))
13
+ return p;
14
+ return node_path_1.default.join(process.env.HOME || process.env.USERPROFILE || '', p.slice(1));
15
+ }
6
16
  class WhatsAppConnect {
7
17
  constructor() {
8
18
  this.description = {
@@ -26,6 +36,7 @@ class WhatsAppConnect {
26
36
  options: [
27
37
  { name: 'Connect', value: 'connect', description: 'Connect to WhatsApp (scan QR on first run)', action: 'Connect to WhatsApp' },
28
38
  { name: 'Get Status', value: 'status', description: 'Get current connection status', action: 'Get connection status' },
39
+ { name: 'Sign Out', value: 'signOut', description: 'Sign out and delete session (requires re-scan QR)', action: 'Sign out of WhatsApp' },
29
40
  ],
30
41
  default: 'connect',
31
42
  },
@@ -64,6 +75,27 @@ class WhatsAppConnect {
64
75
  pairedItem: { item: i },
65
76
  });
66
77
  }
78
+ else if (operation === 'signOut') {
79
+ // Disconnect first
80
+ await (0, WhatsAppApiHelper_1.disconnect)();
81
+ // Delete session files
82
+ const resolvedPath = expandHome(cfg.sessionPath);
83
+ if (node_fs_1.default.existsSync(resolvedPath)) {
84
+ const files = node_fs_1.default.readdirSync(resolvedPath);
85
+ for (const file of files) {
86
+ node_fs_1.default.unlinkSync(node_path_1.default.join(resolvedPath, file));
87
+ }
88
+ node_fs_1.default.rmdirSync(resolvedPath);
89
+ }
90
+ returnData.push({
91
+ json: {
92
+ success: true,
93
+ message: 'Signed out. Session deleted. Run Connect to scan QR again.',
94
+ sessionPath: cfg.sessionPath,
95
+ },
96
+ pairedItem: { item: i },
97
+ });
98
+ }
67
99
  }
68
100
  catch (error) {
69
101
  if (this.continueOnFail()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raevon/n8n-nodes-whatsapp",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "n8n community node for WhatsApp — send and receive messages with anti-ban protection via the Baileys library",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",