n8n-nodes-chat2crm 0.1.9 → 0.1.10
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/README.md
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Структура проекта
|
|
2
|
+
|
|
3
|
+
## Основные директории
|
|
4
|
+
|
|
5
|
+
- **nodes/**
|
|
6
|
+
- `Chat2CrmSend/` — Нода для отправки сообщений
|
|
7
|
+
- `Chat2CrmSend.node.ts` — Основной файл ноды
|
|
8
|
+
- `chat2crm.svg` — Иконка ноды
|
|
9
|
+
- `Chat2CrmTrigger/` — Триггерная нода для прослушивания стримов
|
|
10
|
+
- `Chat2CrmTrigger.node.ts` — Основной файл ноды
|
|
11
|
+
- `chat2crm.svg` — Иконка ноды
|
|
12
|
+
- `Infra/` — Инфраструктурные модули
|
|
13
|
+
- `RedisConnection.ts` — Подключение к Redis
|
|
14
|
+
- `StreamConfig.ts` — Конфигурация потоков Redis
|
|
15
|
+
|
|
16
|
+
- **credentials/**
|
|
17
|
+
- `Chat2CrmRedisApi.credentials.ts` — Credentials для Redis API
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Конфигурационные файлы
|
|
21
|
+
|
|
22
|
+
- `index.js` — Точка входа модуля (экспорт узлов и credentials)
|
|
23
|
+
- `package.json`
|
|
24
|
+
- `package-lock.json`
|
|
25
|
+
- `tsconfig.json`
|
|
26
|
+
- `gulpfile.js`
|
|
27
|
+
- `.eslintrc.js`
|
|
28
|
+
- `.gitignore`
|
|
29
|
+
- `.n8nignore`
|
|
30
|
+
|
|
31
|
+
## Документация
|
|
32
|
+
|
|
33
|
+
- `README.md` — Документация проекта
|
|
34
|
+
- `QUICKSTART.md` — Руководство по быстрому старту
|
|
@@ -166,15 +166,17 @@ async function createRedisConnection(credentials, db = 0) {
|
|
|
166
166
|
console.log(`[Redis Connection] Direct connection to Redis at ${redisHost}:${redisPort}`);
|
|
167
167
|
}
|
|
168
168
|
// Создаем подключение к Redis
|
|
169
|
-
|
|
169
|
+
// ВАЖНО: Используем переданный параметр db, а НЕ credentials.db
|
|
170
|
+
const selectedDb = db; // Явно используем переданный параметр
|
|
171
|
+
console.log(`[Redis Connection] Connecting to Redis: ${redisHost}:${redisPort}, DB: ${selectedDb}`);
|
|
170
172
|
const redis = new ioredis_1.default({
|
|
171
173
|
host: redisHost,
|
|
172
174
|
port: redisPort,
|
|
173
|
-
db: db
|
|
175
|
+
db: selectedDb, // Явно используем переданный параметр db
|
|
174
176
|
password: credentials.password,
|
|
175
177
|
enableReadyCheck: true,
|
|
176
178
|
maxRetriesPerRequest: 3,
|
|
177
|
-
connectTimeout: 10000,
|
|
179
|
+
connectTimeout: 10000,
|
|
178
180
|
retryStrategy: (times) => {
|
|
179
181
|
const delay = Math.min(times * 50, 2000);
|
|
180
182
|
return delay;
|
|
@@ -182,16 +184,24 @@ async function createRedisConnection(credentials, db = 0) {
|
|
|
182
184
|
});
|
|
183
185
|
// Добавляем обработчики событий для диагностики
|
|
184
186
|
redis.on('connect', () => {
|
|
185
|
-
console.log(`[Redis Connection] Connected to Redis at ${redisHost}:${redisPort}, DB ${
|
|
187
|
+
console.log(`[Redis Connection] Connected to Redis at ${redisHost}:${redisPort}, DB ${selectedDb}`);
|
|
186
188
|
});
|
|
187
|
-
redis.on('ready', () => {
|
|
188
|
-
console.log(`[Redis Connection] Redis ready at ${redisHost}:${redisPort}, DB ${
|
|
189
|
+
redis.on('ready', async () => {
|
|
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
|
+
}
|
|
189
199
|
});
|
|
190
200
|
redis.on('error', (err) => {
|
|
191
|
-
console.error(`[Redis Connection] Redis error on ${redisHost}:${redisPort}, DB ${
|
|
201
|
+
console.error(`[Redis Connection] Redis error on ${redisHost}:${redisPort}, DB ${selectedDb}:`, err.message);
|
|
192
202
|
});
|
|
193
203
|
redis.on('close', () => {
|
|
194
|
-
console.log(`[Redis Connection] Redis connection closed: ${redisHost}:${redisPort}, DB ${
|
|
204
|
+
console.log(`[Redis Connection] Redis connection closed: ${redisHost}:${redisPort}, DB ${selectedDb}`);
|
|
195
205
|
});
|
|
196
206
|
return redis;
|
|
197
207
|
}
|