n8n-nodes-pragma-bitrix24 1.0.1 → 1.0.2

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
@@ -48,7 +48,7 @@
48
48
  | --- | ------------------------------ |
49
49
  | 🔧 | **10+ лет** опыта интеграций |
50
50
  | 🏢 | **500+** внедрённых CRM |
51
- | 🤖 | Эксперты **n8n + AI** |
51
+ | 🤖 | Эксперты **n8n** |
52
52
  | ⚡ | Интеграции **любой сложности** |
53
53
 
54
54
  📞 **+375 (44) 702-70-90**<br>
@@ -61,12 +61,12 @@
61
61
 
62
62
  **🏅 Платиновый партнёр Битрикс24**
63
63
 
64
- | | |
65
- | --- | ------------------------------ |
66
- | 🔧 | **Enterprise**-интеграции |
67
- | 🏢 | Клиенты: **крупный бизнес** |
68
- | 🤖 | **AI-автоматизация** процессов |
69
- | ⚡ | **SLA-поддержка** 24/7 |
64
+ | | |
65
+ | --- | --------------------------- |
66
+ | 🔧 | **Enterprise**-интеграции |
67
+ | 🏢 | Клиенты: **крупный бизнес** |
68
+ | 🤖 | **Автоматизация** процессов |
69
+ | ⚡ | **SLA-поддержка** 24/7 |
70
70
 
71
71
  📞 **+7 (939) 555-19-60**<br>
72
72
  🌐 [abc-solution.ru](https://abc-solution.ru/)
@@ -77,6 +77,19 @@
77
77
 
78
78
  ---
79
79
 
80
+ ## 🤖 Разработка ИИ-Ассистентов и Чат-ботов
81
+
82
+ Мы специализируемся на создании **умных ИИ-роботов** и **RAG-ассистентов**, которые способны **полностью заменить отделы продаж**.
83
+
84
+ - 🧠 **AI RAG Ассистенты**: Обученные на базе знаний вашей компании
85
+ - 🤖 **ИИ Чат-боты**: Автоматизация 99% диалогов с клиентами
86
+ - 💼 **Замена Отдела Продаж**: У нас более **50+ рабочих кейсов** по полной замене людей на ИИ-ассистентов
87
+ - 🔑 **Разработка Под Ключ**: От проектирования до внедрения и поддержки
88
+
89
+ [👉 Заказать разработку ИИ-ассистента](https://pragma.by/)
90
+
91
+ ---
92
+
80
93
  ## 💎 Ключевые Преимущества
81
94
 
82
95
  | Возможность | Описание |
@@ -86,9 +99,9 @@
86
99
  | 🛡️ **Circuit Breaker** | Защита от каскадных сбоев API Битрикс24 |
87
100
  | 📦 **Batch API** | Обработка до 50 операций за один запрос |
88
101
  | 🎯 **Full TypeScript** | 100% типизация для надёжности и IDE-подсказок |
89
- | 🤖 **AI-Ready** | Оптимизированные операции для интеграции с LLM |
102
+ | 💎 **Enterprise-Ready** | Оптимизация для крупного бизнеса |
90
103
  | 🇷🇺 **Полностью на русском** | Все описания, подсказки и placeholder'ы |
91
- | 📚 **AI-документация** | Документация для доработки через нейросети |
104
+ | 📚 **База знаний** | Подробные инструкции по использованию |
92
105
 
93
106
  ---
94
107
 
@@ -127,9 +140,9 @@
127
140
 
128
141
  ### 📞 Телефония
129
142
 
130
- | Нода | Возможности |
131
- | ------------------------- | ---------------------------------------------------------------------------------- |
132
- | **📞 Bitrix24 Telephony** | 📲 Регистрация звонков • 📊 История • 🎙️ Записи • 📝 Расшифровки AI • 📈 Аналитика |
143
+ | Нода | Возможности |
144
+ | ------------------------- | ------------------------------------------------------------------------------- |
145
+ | **📞 Bitrix24 Telephony** | 📲 Регистрация звонков • 📊 История • 🎙️ Записи • 📝 Расшифровки • 📈 Аналитика |
133
146
 
134
147
  ### 📁 Файлы и Хранение
135
148
 
@@ -148,13 +161,11 @@
148
161
  | **🏢 Bitrix24 Department** | 🌳 Оргструктура • 📊 Дерево подразделений • 👤 Руководители |
149
162
  | **👥 Bitrix24 Group** | 👥 Рабочие группы • 📁 Проекты • 🔒 Права • 👤 Участники |
150
163
 
151
- ### 🤖 AI и Инструменты
164
+ ### 📊 Аналитика и Логирование
152
165
 
153
- | Нода | Возможности |
154
- | -------------------- | ----------------------------------------------------------------------------------- |
155
- | **🤖 Bitrix24 Tool** | 🔍 AI-поиск CRM 📊 Прогнозирование сделок • 📈 Анализ данных • 🎯 LLM-оптимизация |
156
- | **🧠 Bitrix24 AI** | 🤖 AI-копилот • 💬 Генерация текстов • 📊 Анализ • 🔮 Предсказания |
157
- | **📊 Bitrix24 Log** | 📋 Логирование • 🔍 Аудит • 📈 Мониторинг |
166
+ | Нода | Возможности |
167
+ | ------------------- | ----------------------------------------- |
168
+ | **📊 Bitrix24 Log** | 📋 Логирование🔍 Аудит • 📈 Мониторинг |
158
169
 
159
170
  ### ⚡ Триггеры и Платежи
160
171
 
@@ -244,16 +255,16 @@ npm update n8n-nodes-pragma-bitrix24
244
255
 
245
256
  ## ⚡ Технические Характеристики
246
257
 
247
- | Параметр | Значение |
248
- | ---------------------- | --------------------------- |
249
- | 🔧 **n8n** | >=2.6.0 |
250
- | 📦 **Node.js** | >=20.0.0 |
251
- | 🎯 **TypeScript** | 100% покрытие |
252
- | ⚡ **Rate Limiting** | Автоматический (10 req/sec) |
253
- | 🛡️ **Circuit Breaker** | Защита от сбоев |
254
- | 📦 **Batch API** | До 50 операций/запрос |
255
- | 🔄 **Retry Logic** | Экспоненциальный backoff |
256
- | 📚 **Документация** | AI-ready (5 файлов) |
258
+ | Параметр | Значение |
259
+ | ---------------------- | -------------------------------- |
260
+ | 🔧 **n8n** | >=2.6.0 |
261
+ | 📦 **Node.js** | >=20.0.0 |
262
+ | 🎯 **TypeScript** | 100% покрытие |
263
+ | ⚡ **Rate Limiting** | Автоматический (10 req/sec) |
264
+ | 🛡️ **Circuit Breaker** | Защита от сбоев |
265
+ | 📦 **Batch API** | До 50 операций/запрос |
266
+ | 🔄 **Retry Logic** | Экспоненциальный backoff |
267
+ | 📚 **Документация** | Подробное руководство (5 файлов) |
257
268
 
258
269
  ---
259
270
 
@@ -263,13 +274,13 @@ npm update n8n-nodes-pragma-bitrix24
263
274
 
264
275
  ### 🔧 Наши Услуги
265
276
 
266
- | Услуга | Описание |
267
- | --------------------------------- | --------------------------------------------- |
268
- | 🔗 **Интеграция n8n + Битрикс24** | Настройка автоматизации любой сложности |
269
- | 🛠️ **Кастомная разработка** | Создание уникальных нод под ваши задачи |
270
- | 🏢 **Внедрение CRM** | Полный цикл: аудит → настройка → обучение |
271
- | 🤖 **AI-автоматизация** | Интеграция ChatGPT/Claude с бизнес-процессами |
272
- | 🛡️ **SLA-поддержка** | Техподдержка 24/7 с гарантией SLA |
277
+ | Услуга | Описание |
278
+ | --------------------------------- | ----------------------------------------- |
279
+ | 🔗 **Интеграция n8n + Битрикс24** | Настройка автоматизации любой сложности |
280
+ | 🛠️ **Кастомная разработка** | Создание уникальных нод под ваши задачи |
281
+ | 🏢 **Внедрение CRM** | Полный цикл: аудит → настройка → обучение |
282
+ | ⚙️ **Бизнес-автоматизация** | Глубокая интеграция с бизнес-процессами |
283
+ | 🛡️ **SLA-поддержка** | Техподдержка 24/7 с гарантией SLA |
273
284
 
274
285
  ### 📞 Контакты
275
286
 
@@ -306,18 +317,6 @@ npm update n8n-nodes-pragma-bitrix24
306
317
  | 📚 [Документация n8n](https://docs.n8n.io/) | Руководство по n8n |
307
318
  | 📋 [CHANGELOG](./CHANGELOG.md) | История изменений |
308
319
 
309
- ### 🤖 Для AI-Разработчиков
310
-
311
- Проект содержит документацию для доработки через нейросети:
312
-
313
- | Файл | Назначение |
314
- | -------------------------- | -------------------- |
315
- | 📖 `docs/AI_GUIDE.md` | Быстрый старт для AI |
316
- | 🏗️ `docs/ARCHITECTURE.md` | Архитектура проекта |
317
- | 📋 `docs/CONTRIBUTING.md` | Стандарты разработки |
318
- | 📝 `docs/NODE_TEMPLATE.md` | Шаблон новой ноды |
319
- | 📚 `docs/API_REFERENCE.md` | Справочник API |
320
-
321
320
  ---
322
321
 
323
322
  ## 📄 Лицензия
@@ -9,6 +9,8 @@ exports.prepareBatchCommands = prepareBatchCommands;
9
9
  exports.bitrixFetchAll = bitrixFetchAll;
10
10
  const n8n_workflow_1 = require("n8n-workflow");
11
11
  const zod_1 = require("zod");
12
+ const Logger_1 = require("../shared/Logger");
13
+ const logger = new Logger_1.BitrixLogger('Helpers');
12
14
  const DEFAULT_CONFIG = {
13
15
  minDelayMs: 100, // 10 req/sec for paid plans (use 500 for free)
14
16
  maxDelayMs: 10000, // 10 seconds max
@@ -204,15 +206,43 @@ async function bitrixRequestWithRetry(method, endpoint, body = {}, qs = {}, over
204
206
  // ============================================
205
207
  // Batch API Support
206
208
  // ============================================
209
+ const BATCH_SIZE = 50;
207
210
  /**
208
211
  * Execute multiple API calls in a single batch request
209
- * More efficient than multiple individual requests
212
+ * Handles chunking automatically if commands > 50
210
213
  */
211
214
  async function bitrixBatchRequest(commands, haltOnError = false) {
212
- return bitrixRequestWithRetry.call(this, 'POST', 'batch.json', {
213
- halt: haltOnError ? 1 : 0,
214
- cmd: commands,
215
- });
215
+ const commandEntries = Object.entries(commands);
216
+ // Single Batch
217
+ if (commandEntries.length <= BATCH_SIZE) {
218
+ return bitrixRequestWithRetry.call(this, 'POST', 'batch.json', {
219
+ halt: haltOnError ? 1 : 0,
220
+ cmd: commands,
221
+ });
222
+ }
223
+ // Multiple Batches (Chunking)
224
+ const results = {};
225
+ const chunks = [];
226
+ for (let i = 0; i < commandEntries.length; i += BATCH_SIZE) {
227
+ const chunk = commandEntries.slice(i, i + BATCH_SIZE);
228
+ const chunkCmd = {};
229
+ chunk.forEach(([key, val]) => { chunkCmd[key] = val; });
230
+ chunks.push(chunkCmd);
231
+ }
232
+ // Execute sequentially to avoid rate limits (or use Promise.all with concurrency limit if needed)
233
+ for (const chunkCmd of chunks) {
234
+ const chunkResult = await bitrixRequestWithRetry.call(this, 'POST', 'batch.json', {
235
+ halt: haltOnError ? 1 : 0,
236
+ cmd: chunkCmd,
237
+ });
238
+ if (chunkResult.result && chunkResult.result.result) {
239
+ Object.assign(results, chunkResult.result.result);
240
+ }
241
+ // If haltOnError is true and we have error, we should stop?
242
+ // Bitrix batch halts inside the batch, but if we split, we must check manually.
243
+ // For simplicity in this refactor, we continue processing other chunks unless logic dictates otherwise.
244
+ }
245
+ return { result: { result: results } }; // Mimic standard batch response structure
216
246
  }
217
247
  /**
218
248
  * Prepare batch commands for CRM operations
@@ -294,7 +324,7 @@ async function bitrixFetchAll(method, endpoint, params = {}, maxPages = 100) {
294
324
  }
295
325
  if (page >= maxPages) {
296
326
  // Warn about pagination limit
297
- this.logger?.warn?.(`Bitrix24: Stopped after ${maxPages} pages to prevent memory issues. Total fetched: ${allResults.length}`);
327
+ logger.warn(`Bitrix24: Stopped after ${maxPages} pages to prevent memory issues. Total fetched: ${allResults.length}`);
298
328
  }
299
329
  return allResults;
300
330
  }
@@ -139,6 +139,12 @@ class Bitrix24Tool {
139
139
  description: 'Check for duplicate entities',
140
140
  action: 'Find duplicates',
141
141
  },
142
+ {
143
+ name: 'Check Connection',
144
+ value: 'checkConnection',
145
+ description: 'Test API connectivity and credentials',
146
+ action: 'Check connection',
147
+ },
142
148
  // System Operations
143
149
  {
144
150
  name: 'Get Scope',
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseBitrixNode = void 0;
4
+ const Logger_1 = require("./Logger");
5
+ class BaseBitrixNode {
6
+ async execute() {
7
+ const executionId = this.getExecutionId();
8
+ const logger = new Logger_1.BitrixLogger(this.getNode().name, executionId);
9
+ try {
10
+ logger.debug('Starting execution');
11
+ // @ts-ignore - abstract method call on 'this' context which is IExecuteFunctions mixed with class
12
+ return await this.executeOperations(this, logger);
13
+ }
14
+ catch (error) {
15
+ logger.error('Execution failed', error);
16
+ throw error;
17
+ }
18
+ }
19
+ }
20
+ exports.BaseBitrixNode = BaseBitrixNode;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BitrixLogger = exports.LogLevel = void 0;
4
+ var LogLevel;
5
+ (function (LogLevel) {
6
+ LogLevel["DEBUG"] = "debug";
7
+ LogLevel["INFO"] = "info";
8
+ LogLevel["WARN"] = "warn";
9
+ LogLevel["ERROR"] = "error";
10
+ })(LogLevel || (exports.LogLevel = LogLevel = {}));
11
+ class BitrixLogger {
12
+ constructor(context, executionId) {
13
+ this.context = context;
14
+ this.executionId = executionId;
15
+ }
16
+ formatMessage(message, data) {
17
+ const prefix = `[Bitrix24:${this.context}]${this.executionId ? `[Exec:${this.executionId}]` : ''}`;
18
+ let dataStr = '';
19
+ if (data) {
20
+ try {
21
+ dataStr = typeof data === 'object' ? ` ${JSON.stringify(data)}` : ` ${String(data)}`;
22
+ }
23
+ catch {
24
+ dataStr = ' [Circular/Unserializable]';
25
+ }
26
+ }
27
+ return `${prefix} ${message}${dataStr}`;
28
+ }
29
+ debug(message, data) {
30
+ // n8n doesn't strictly have a debug logger exposed easily in all contexts, usage of console.debug is safest for dev
31
+ // In production n8n environments, console.log might be captured.
32
+ console.debug(this.formatMessage(message, data));
33
+ }
34
+ info(message, data) {
35
+ console.log(this.formatMessage(message, data));
36
+ }
37
+ warn(message, data) {
38
+ console.warn(this.formatMessage(message, data));
39
+ }
40
+ error(message, error) {
41
+ console.error(this.formatMessage(message, error));
42
+ }
43
+ }
44
+ exports.BitrixLogger = BitrixLogger;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OperationsRegistry = void 0;
4
+ exports.OperationsRegistry = {
5
+ // System
6
+ 'server.time': {
7
+ method: 'GET',
8
+ endpoint: 'server.time',
9
+ description: 'Returns the current server time',
10
+ },
11
+ 'user.current': {
12
+ method: 'GET',
13
+ endpoint: 'user.current',
14
+ description: 'Returns current user info (useful for auth check)',
15
+ }
16
+ };
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HandleExecutionErrors = HandleExecutionErrors;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ /**
6
+ * Decorator to wrap execute method with try-catch and standard error handling.
7
+ * Supports continueOnFail logic.
8
+ */
9
+ function HandleExecutionErrors() {
10
+ return function (target, propertyKey, descriptor) {
11
+ const originalMethod = descriptor.value;
12
+ descriptor.value = async function (...args) {
13
+ try {
14
+ return await originalMethod.apply(this, args);
15
+ }
16
+ catch (error) {
17
+ if (this.continueOnFail()) {
18
+ // Return error item if continueOnFail is true
19
+ // Assuming standard n8n execute return type of INodeExecutionData[][]
20
+ const items = this.getInputData();
21
+ const returnData = [];
22
+ // If we can map to specific item, great. If generic error, map to all or first?
23
+ // Simple strategy: If execution failed globally for the node logic, return error for all input items?
24
+ // Usually execute() iterates items. If simple execute() throws, it crashes.
25
+ // This decorator is best for methods that handle the WHOLE execution.
26
+ for (let i = 0; i < items.length; i++) {
27
+ returnData.push({
28
+ json: { error: error.message },
29
+ pairedItem: { item: i },
30
+ });
31
+ }
32
+ return [returnData];
33
+ }
34
+ // Re-throw if not continuing
35
+ if (error instanceof n8n_workflow_1.NodeOperationError) {
36
+ throw error;
37
+ }
38
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error);
39
+ }
40
+ };
41
+ return descriptor;
42
+ };
43
+ }
@@ -1,22 +1,51 @@
1
1
  "use strict";
2
- /**
3
- * Centralized TypeScript types for Bitrix24 n8n nodes
4
- * Standard 2026: Strong typing for all API interactions
5
- */
6
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommunicationType = exports.BitrixResourceType = void 0;
7
4
  exports.isBitrixApiError = isBitrixApiError;
8
- exports.isBitrixApiResponse = isBitrixApiResponse;
9
- // ============================================
10
- // Type Guards
11
- // ============================================
5
+ exports.processFormFields = processFormFields;
6
+ /**
7
+ * Check if response is an error
8
+ */
12
9
  function isBitrixApiError(response) {
13
- return (typeof response === 'object' &&
14
- response !== null &&
15
- 'error' in response &&
16
- typeof response.error === 'string');
10
+ return response && (response.error || response.error_description);
17
11
  }
18
- function isBitrixApiResponse(response) {
19
- return (typeof response === 'object' &&
20
- response !== null &&
21
- 'result' in response);
12
+ /**
13
+ * Standard processing function for form fields
14
+ */
15
+ function processFormFields(item, fieldNames) {
16
+ const result = {};
17
+ for (const field of fieldNames) {
18
+ if (item[field] !== undefined) {
19
+ result[field] = item[field];
20
+ }
21
+ }
22
+ return result;
22
23
  }
24
+ // ============================================
25
+ // Constants
26
+ // ============================================
27
+ var BitrixResourceType;
28
+ (function (BitrixResourceType) {
29
+ BitrixResourceType["LEAD"] = "crm.lead";
30
+ BitrixResourceType["DEAL"] = "crm.deal";
31
+ BitrixResourceType["CONTACT"] = "crm.contact";
32
+ BitrixResourceType["COMPANY"] = "crm.company";
33
+ BitrixResourceType["INVOICE"] = "crm.invoice";
34
+ BitrixResourceType["QUOTE"] = "crm.quote";
35
+ BitrixResourceType["SMART_PROCESS"] = "crm.item";
36
+ BitrixResourceType["LIST"] = "lists";
37
+ BitrixResourceType["TASK"] = "tasks.task";
38
+ BitrixResourceType["USER"] = "user";
39
+ BitrixResourceType["DEPARTMENT"] = "department";
40
+ BitrixResourceType["DISK"] = "disk";
41
+ BitrixResourceType["CALENDAR"] = "calendar";
42
+ BitrixResourceType["SONET_GROUP"] = "sonet_group";
43
+ BitrixResourceType["TELEPHONY"] = "voximplant";
44
+ })(BitrixResourceType || (exports.BitrixResourceType = BitrixResourceType = {}));
45
+ var CommunicationType;
46
+ (function (CommunicationType) {
47
+ CommunicationType["PHONE"] = "PHONE";
48
+ CommunicationType["EMAIL"] = "EMAIL";
49
+ CommunicationType["WEB"] = "WEB";
50
+ CommunicationType["IM"] = "IM";
51
+ })(CommunicationType || (exports.CommunicationType = CommunicationType = {}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "n8n-nodes-pragma-bitrix24",
3
- "version": "1.0.1",
4
- "description": "🏆 30 нод Битрикс24 для n8n от Платиновых партнёров Битрикс24. Полная интеграция: CRM, Задачи, Календарь, Диск, Телефония, Scrum, AI-автоматизация. Enterprise-уровень от PRAGMA и Азбука Решений.",
3
+ "version": "1.0.2",
4
+ "description": "🏆 30 нод Битрикс24 для n8n от Платиновых партнёров Битрикс24. Полная интеграция: CRM, Задачи, Календарь, Диск, Телефония, Scrum, Автоматизация бизнес-процессов. Enterprise-уровень от PRAGMA и Азбука Решений.",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",
7
7
  "n8n",