n8n-nodes-chat2crm 0.1.12 → 0.1.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.
@@ -106,6 +106,14 @@ class Chat2CrmTrigger {
106
106
  // Инициализируем lastReadIds для каждого stream и собираем информацию
107
107
  for (const [db, dbStreams] of streamsByDb.entries()) {
108
108
  const redis = redisConnections.get(db);
109
+ // ИСПРАВЛЕНИЕ: Явно выбираем базу данных перед проверкой stream'ов
110
+ try {
111
+ await redis.select(db);
112
+ console.log(`[Chat2Crm Trigger] Selected DB ${db} before checking streams`);
113
+ }
114
+ catch (error) {
115
+ console.error(`[Chat2Crm Trigger] Failed to select DB ${db}:`, error.message);
116
+ }
109
117
  for (const stream of dbStreams) {
110
118
  try {
111
119
  // Пытаемся получить информацию о stream
@@ -188,14 +188,10 @@ async function createRedisConnection(credentials, db = 0) {
188
188
  });
189
189
  redis.on('ready', async () => {
190
190
  console.log(`[Redis Connection] Redis ready at ${redisHost}:${redisPort}, DB ${selectedDb}`);
191
- // Явно выбираем базу данных после готовности подключения
192
- try {
193
- await redis.select(selectedDb);
194
- console.log(`[Redis Connection] Explicitly selected DB ${selectedDb}`);
195
- }
196
- catch (error) {
197
- console.error(`[Redis Connection] Failed to select DB ${selectedDb}:`, error.message);
198
- }
191
+ // УБИРАЕМ select - он не нужен, так как db уже указан в конфигурации
192
+ // И вызов select после ready может вызвать проблемы, если проверка stream'ов уже началась
193
+ // await redis.select(selectedDb);
194
+ // console.log(`[Redis Connection] Explicitly selected DB ${selectedDb}`);
199
195
  });
200
196
  redis.on('error', (err) => {
201
197
  console.error(`[Redis Connection] Redis error on ${redisHost}:${redisPort}, DB ${selectedDb}:`, err.message);
@@ -70,13 +70,13 @@ exports.STREAM_DEFINITIONS = [
70
70
  },
71
71
  {
72
72
  name: 'N8N Incoming Message',
73
- value: 'n8n_incoming_message',
73
+ value: 'N8N_INCOMING_MESSAGE',
74
74
  description: 'Incoming messages to N8N (DB 1)',
75
75
  db: 1,
76
76
  },
77
77
  {
78
78
  name: 'N8N Outgoing Message',
79
- value: 'n8n_outgoing_message',
79
+ value: 'N8N_OUTGOING_MESSAGE',
80
80
  description: 'Outgoing messages from N8N (DB 1)',
81
81
  db: 1,
82
82
  },
@@ -90,6 +90,9 @@ exports.STREAM_DB_MAP = {
90
90
  crm_lazy_incoming_message: 1,
91
91
  crm_contacts: 1,
92
92
  crm_outgoing_status: 1,
93
+ N8N_INCOMING_MESSAGE: 1,
94
+ N8N_OUTGOING_MESSAGE: 1,
95
+ // Поддержка старого формата (строчными) для обратной совместимости
93
96
  n8n_incoming_message: 1,
94
97
  n8n_outgoing_message: 1,
95
98
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-chat2crm",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "n8n node for Chat2Crm Redis integration",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",