n8n-nodes-pragma-bitrix24 1.0.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.
Files changed (51) hide show
  1. package/LICENSE +51 -0
  2. package/README.md +340 -0
  3. package/dist/credentials/Bitrix24Api.credentials.js +55 -0
  4. package/dist/nodes/Bitrix24/Bitrix24.node.js +1410 -0
  5. package/dist/nodes/Bitrix24/Company.js +17 -0
  6. package/dist/nodes/Bitrix24/Contact.js +31 -0
  7. package/dist/nodes/Bitrix24/Deal.js +17 -0
  8. package/dist/nodes/Bitrix24/Helpers.js +300 -0
  9. package/dist/nodes/Bitrix24/Lead.js +17 -0
  10. package/dist/nodes/Bitrix24/SmartProcess.js +1 -0
  11. package/dist/nodes/Bitrix24/bitrix24.svg +7 -0
  12. package/dist/nodes/Bitrix24/types.js +58 -0
  13. package/dist/nodes/Bitrix24AI/Bitrix24AI.node.js +205 -0
  14. package/dist/nodes/Bitrix24App/Bitrix24App.node.js +179 -0
  15. package/dist/nodes/Bitrix24Auxiliary/Bitrix24Auxiliary.node.js +566 -0
  16. package/dist/nodes/Bitrix24Booking/Bitrix24Booking.node.js +871 -0
  17. package/dist/nodes/Bitrix24Calendar/Bitrix24Calendar.node.js +471 -0
  18. package/dist/nodes/Bitrix24ChatBot/Bitrix24ChatBot.node.js +522 -0
  19. package/dist/nodes/Bitrix24Commerce/Bitrix24Commerce.node.js +431 -0
  20. package/dist/nodes/Bitrix24Department/Bitrix24Department.node.js +317 -0
  21. package/dist/nodes/Bitrix24Disk/Bitrix24Disk.node.js +334 -0
  22. package/dist/nodes/Bitrix24Document/Bitrix24Document.node.js +280 -0
  23. package/dist/nodes/Bitrix24Entity/Bitrix24Entity.node.js +263 -0
  24. package/dist/nodes/Bitrix24Group/Bitrix24Group.node.js +327 -0
  25. package/dist/nodes/Bitrix24Lists/Bitrix24Lists.node.js +406 -0
  26. package/dist/nodes/Bitrix24Log/Bitrix24Log.node.js +309 -0
  27. package/dist/nodes/Bitrix24Mail/Bitrix24Mail.node.js +109 -0
  28. package/dist/nodes/Bitrix24MessageService/Bitrix24MessageService.node.js +218 -0
  29. package/dist/nodes/Bitrix24OpenChannels/Bitrix24OpenChannels.node.js +379 -0
  30. package/dist/nodes/Bitrix24PaySystem/Bitrix24PaySystem.node.js +241 -0
  31. package/dist/nodes/Bitrix24Pipeline/Bitrix24Pipeline.node.js +553 -0
  32. package/dist/nodes/Bitrix24Pipeline/bitrix24.svg +7 -0
  33. package/dist/nodes/Bitrix24Sale/Bitrix24Sale.node.js +391 -0
  34. package/dist/nodes/Bitrix24Scrum/Bitrix24Scrum.node.js +555 -0
  35. package/dist/nodes/Bitrix24Scrum/bitrix24.svg +7 -0
  36. package/dist/nodes/Bitrix24Sign/Bitrix24Sign.node.js +132 -0
  37. package/dist/nodes/Bitrix24Social/Bitrix24Social.node.js +224 -0
  38. package/dist/nodes/Bitrix24Task/Bitrix24Task.node.js +444 -0
  39. package/dist/nodes/Bitrix24Telephony/Bitrix24Telephony.node.js +511 -0
  40. package/dist/nodes/Bitrix24Timeman/Bitrix24Timeman.node.js +196 -0
  41. package/dist/nodes/Bitrix24Tool/Bitrix24Tool.node.js +1035 -0
  42. package/dist/nodes/Bitrix24Tool/bitrix24.svg +7 -0
  43. package/dist/nodes/Bitrix24Trigger/Bitrix24Trigger.node.js +184 -0
  44. package/dist/nodes/Bitrix24User/Bitrix24User.node.js +351 -0
  45. package/dist/nodes/Bitrix24UserField/Bitrix24UserField.node.js +386 -0
  46. package/dist/nodes/Bitrix24UserField/bitrix24.svg +7 -0
  47. package/dist/nodes/shared/bitrix24.svg +7 -0
  48. package/dist/nodes/shared/localization.js +189 -0
  49. package/dist/nodes/shared/types.js +22 -0
  50. package/index.js +10 -0
  51. package/package.json +108 -0
@@ -0,0 +1,444 @@
1
+ "use strict";
2
+ /**
3
+ * Bitrix24 Task — Нода управления задачами
4
+ *
5
+ * Bitrix24 PRAGMA.by nodes for n8n
6
+ * Профессиональная интеграция с Битрикс24.
7
+ *
8
+ * @author PRAGMA & Азбука Решений
9
+ * @copyright 2026 PRAGMA (https://pragma.by/) & Азбука Решений (https://abc-solution.ru/)
10
+ *
11
+ * Контакты:
12
+ * 🇧🇾 PRAGMA: +375 (44) 702-70-90 | https://pragma.by/
13
+ * 🇷🇺 Азбука Решений: +7 (939) 555-19-60 | https://abc-solution.ru/
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.Bitrix24Task = void 0;
17
+ const Helpers_1 = require("../Bitrix24/Helpers");
18
+ class Bitrix24Task {
19
+ constructor() {
20
+ this.description = {
21
+ displayName: 'Bitrix24 Задачи',
22
+ name: 'bitrix24Task',
23
+ icon: 'file:bitrix24.svg',
24
+ group: ['transform'],
25
+ version: 1,
26
+ subtitle: '={{$parameter["operation"]}}',
27
+ description: 'Управление задачами в Битрикс24: создание, обновление, чеклисты, комментарии, делегирование',
28
+ defaults: {
29
+ name: 'Bitrix24 Задачи',
30
+ },
31
+ inputs: ['main'],
32
+ outputs: ['main'],
33
+ credentials: [
34
+ {
35
+ name: 'bitrix24Api',
36
+ required: true,
37
+ },
38
+ ],
39
+ properties: [
40
+ {
41
+ displayName: 'Операция',
42
+ name: 'operation',
43
+ type: 'options',
44
+ noDataExpression: true,
45
+ options: [
46
+ {
47
+ name: 'Создать',
48
+ value: 'create',
49
+ action: 'Создать задачу',
50
+ },
51
+ {
52
+ name: 'Получить',
53
+ value: 'get',
54
+ action: 'Получить задачу',
55
+ },
56
+ {
57
+ name: 'Список',
58
+ value: 'list',
59
+ action: 'Получить список задач',
60
+ },
61
+ {
62
+ name: 'Обновить',
63
+ value: 'update',
64
+ action: 'Обновить задачу',
65
+ },
66
+ {
67
+ name: 'Удалить',
68
+ value: 'delete',
69
+ action: 'Удалить задачу',
70
+ },
71
+ {
72
+ name: 'Добавить комментарий',
73
+ value: 'add_comment',
74
+ action: 'Добавить комментарий к задаче',
75
+ },
76
+ {
77
+ name: 'Добавить пункт чеклиста',
78
+ value: 'checklist_add',
79
+ action: 'Добавить пункт в чеклист',
80
+ },
81
+ {
82
+ name: 'Удалить пункт чеклиста',
83
+ value: 'checklist_delete',
84
+ action: 'Удалить пункт из чеклиста',
85
+ },
86
+ {
87
+ name: 'Завершить пункт чеклиста',
88
+ value: 'checklist_complete',
89
+ action: 'Завершить пункт чеклиста',
90
+ },
91
+ {
92
+ name: 'Стадии (Kanban)',
93
+ value: 'stage_list',
94
+ action: 'Получить стадии Kanban',
95
+ description: 'Получить стадии для группы/проекта',
96
+ },
97
+ {
98
+ name: 'Делегировать',
99
+ value: 'delegate',
100
+ action: 'Делегировать задачу',
101
+ description: 'Переназначить задачу другому пользователю',
102
+ },
103
+ {
104
+ name: 'Создать из шаблона',
105
+ value: 'createFromTemplate',
106
+ action: 'Создать задачу из шаблона',
107
+ },
108
+ ],
109
+ default: 'create',
110
+ required: true,
111
+ },
112
+ // Поля создания/обновления
113
+ {
114
+ displayName: 'Название',
115
+ name: 'title',
116
+ type: 'string',
117
+ default: '',
118
+ required: true,
119
+ placeholder: 'Подготовить отчёт за месяц',
120
+ displayOptions: {
121
+ show: {
122
+ operation: ['create'],
123
+ },
124
+ },
125
+ description: 'Название задачи',
126
+ },
127
+ {
128
+ displayName: 'Title',
129
+ name: 'title',
130
+ type: 'string',
131
+ default: '',
132
+ displayOptions: {
133
+ show: {
134
+ operation: ['update'],
135
+ },
136
+ },
137
+ description: 'Task title',
138
+ },
139
+ {
140
+ displayName: 'Description',
141
+ name: 'description',
142
+ type: 'string',
143
+ default: '',
144
+ displayOptions: {
145
+ show: {
146
+ operation: ['create', 'update'],
147
+ },
148
+ },
149
+ description: 'Task description',
150
+ },
151
+ {
152
+ displayName: 'Responsible ID',
153
+ name: 'responsibleId',
154
+ type: 'string',
155
+ default: '',
156
+ displayOptions: {
157
+ show: {
158
+ operation: ['create', 'update'],
159
+ },
160
+ },
161
+ description: 'ID of the user responsible',
162
+ },
163
+ {
164
+ displayName: 'Deadline',
165
+ name: 'deadline',
166
+ type: 'dateTime',
167
+ default: '',
168
+ displayOptions: {
169
+ show: {
170
+ operation: ['create', 'update'],
171
+ },
172
+ },
173
+ description: 'Task deadline',
174
+ },
175
+ // ID Field for Get/Update/Delete/AddComment
176
+ {
177
+ displayName: 'Task ID',
178
+ name: 'id',
179
+ type: 'string',
180
+ default: '',
181
+ required: true,
182
+ displayOptions: {
183
+ show: {
184
+ operation: ['get', 'update', 'delete', 'add_comment'],
185
+ },
186
+ },
187
+ description: 'ID of the task',
188
+ },
189
+ // Comment Fields
190
+ {
191
+ displayName: 'Comment Message',
192
+ name: 'message',
193
+ type: 'string',
194
+ default: '',
195
+ required: true,
196
+ displayOptions: {
197
+ show: {
198
+ operation: ['add_comment'],
199
+ },
200
+ },
201
+ description: 'Text of the comment',
202
+ },
203
+ // Checklist Fields
204
+ {
205
+ displayName: 'Checklist Text',
206
+ name: 'checklistText',
207
+ type: 'string',
208
+ default: '',
209
+ required: true,
210
+ displayOptions: {
211
+ show: {
212
+ operation: ['checklist_add'],
213
+ },
214
+ },
215
+ description: 'Text of the checklist item',
216
+ },
217
+ {
218
+ displayName: 'Checklist Item ID',
219
+ name: 'checklistId',
220
+ type: 'string',
221
+ default: '',
222
+ required: true,
223
+ displayOptions: {
224
+ show: {
225
+ operation: ['checklist_delete', 'checklist_complete'],
226
+ },
227
+ },
228
+ description: 'ID of the checklist item',
229
+ },
230
+ {
231
+ displayName: 'Project ID (Group)',
232
+ name: 'projectId',
233
+ type: 'string',
234
+ default: '0',
235
+ displayOptions: {
236
+ show: {
237
+ operation: ['stage_list'],
238
+ },
239
+ },
240
+ description: 'ID of the group/project. 0 for My Planner.',
241
+ },
242
+ // List Fields
243
+ {
244
+ displayName: 'Limit',
245
+ name: 'limit',
246
+ type: 'number',
247
+ default: 50,
248
+ displayOptions: {
249
+ show: {
250
+ operation: ['list'],
251
+ },
252
+ },
253
+ description: 'Max number of results',
254
+ },
255
+ {
256
+ displayName: 'Filter JSON',
257
+ name: 'filterJson',
258
+ type: 'json',
259
+ default: '{}',
260
+ displayOptions: {
261
+ show: {
262
+ operation: ['list'],
263
+ },
264
+ },
265
+ description: 'Filter in JSON format (e.g. {"RESPONSIBLE_ID": 1})',
266
+ },
267
+ {
268
+ displayName: 'Template ID',
269
+ name: 'templateId',
270
+ type: 'string',
271
+ default: '',
272
+ required: true,
273
+ displayOptions: {
274
+ show: {
275
+ operation: ['createFromTemplate'],
276
+ },
277
+ },
278
+ description: 'ID of the task template',
279
+ },
280
+ ],
281
+ };
282
+ }
283
+ async execute() {
284
+ const items = this.getInputData();
285
+ const returnData = [];
286
+ const operation = this.getNodeParameter('operation', 0);
287
+ for (let i = 0; i < items.length; i++) {
288
+ try {
289
+ let endpoint = '';
290
+ let body = {};
291
+ if (operation === 'create' || operation === 'update') {
292
+ endpoint = operation === 'create' ? 'tasks.task.add' : 'tasks.task.update';
293
+ const fields = {};
294
+ const title = this.getNodeParameter('title', i, '');
295
+ if (title)
296
+ fields.TITLE = title;
297
+ const description = this.getNodeParameter('description', i, '');
298
+ if (description)
299
+ fields.DESCRIPTION = description;
300
+ const responsibleId = this.getNodeParameter('responsibleId', i, '');
301
+ if (responsibleId)
302
+ fields.RESPONSIBLE_ID = responsibleId;
303
+ const deadline = this.getNodeParameter('deadline', i, '');
304
+ if (deadline)
305
+ fields.DEADLINE = deadline;
306
+ if (operation === 'create') {
307
+ body = { fields };
308
+ }
309
+ else {
310
+ const id = this.getNodeParameter('id', i);
311
+ body = { taskId: id, fields };
312
+ }
313
+ }
314
+ if (operation === 'get') {
315
+ endpoint = 'tasks.task.get';
316
+ const id = this.getNodeParameter('id', i);
317
+ body = { taskId: id };
318
+ }
319
+ if (operation === 'delete') {
320
+ endpoint = 'tasks.task.delete';
321
+ const id = this.getNodeParameter('id', i);
322
+ body = { taskId: id };
323
+ }
324
+ if (operation === 'add_comment') {
325
+ endpoint = 'task.comment.item.add';
326
+ const id = this.getNodeParameter('id', i);
327
+ const message = this.getNodeParameter('message', i);
328
+ body = { taskId: id, fields: { POST_MESSAGE: message } };
329
+ }
330
+ if (operation === 'checklist_add') {
331
+ endpoint = 'task.checklistitem.add';
332
+ const id = this.getNodeParameter('id', i);
333
+ const text = this.getNodeParameter('checklistText', i);
334
+ body = { taskId: id, fields: { TITLE: text } };
335
+ }
336
+ if (operation === 'checklist_delete') {
337
+ endpoint = 'task.checklistitem.delete';
338
+ const id = this.getNodeParameter('id', i);
339
+ const itemId = this.getNodeParameter('checklistId', i);
340
+ body = { taskId: id, itemId };
341
+ }
342
+ if (operation === 'checklist_complete') {
343
+ endpoint = 'task.checklistitem.complete';
344
+ const id = this.getNodeParameter('id', i);
345
+ const itemId = this.getNodeParameter('checklistId', i);
346
+ body = { taskId: id, itemId };
347
+ }
348
+ if (operation === 'stage_list') {
349
+ endpoint = 'task.stages.get';
350
+ const projectId = this.getNodeParameter('projectId', i); // defaults to 0
351
+ body = { entityId: projectId };
352
+ }
353
+ if (operation === 'list') {
354
+ endpoint = 'tasks.task.list';
355
+ const limit = this.getNodeParameter('limit', i);
356
+ const filterJson = this.getNodeParameter('filterJson', i, '{}');
357
+ let filter = {};
358
+ try {
359
+ filter = JSON.parse(filterJson);
360
+ }
361
+ catch (e) { }
362
+ body = { filter, start: 0 };
363
+ // Simplified list for now, just first page or respected limit if < 50
364
+ }
365
+ if (operation === 'delegate') {
366
+ endpoint = 'tasks.task.delegate';
367
+ const id = this.getNodeParameter('id', i);
368
+ const userId = this.getNodeParameter('responsibleId', i); // Reuse responsibleId
369
+ body = { taskId: id, userId };
370
+ }
371
+ if (operation === 'createFromTemplate') {
372
+ // 1. Get Template
373
+ const templateId = this.getNodeParameter('templateId', i);
374
+ const tmpl = await Helpers_1.bitrixRequestWithRetry.call(this, 'POST', 'tasks.task.template.get', { taskId: templateId, templateId: templateId });
375
+ // API Note: tasks.task.template.get uses `taskId` param for ID in some versions, or `id`.
376
+ // Retrying with standard params if needed.
377
+ // 2. Extract fields
378
+ const tmplResult = tmpl.result;
379
+ const fields = tmplResult?.DATA || {}; // check structure
380
+ // 3. Create Task
381
+ endpoint = 'tasks.task.add';
382
+ // Cleanup fields (remove ID, etc)
383
+ delete fields.ID;
384
+ delete fields.CREATED_BY;
385
+ delete fields.CREATED_DATE;
386
+ // Apply overrides if any? For now, straight copy.
387
+ body = { fields };
388
+ }
389
+ const response = await Helpers_1.bitrixRequestWithRetry.call(this, 'POST', endpoint + '.json', body);
390
+ let result = response.result;
391
+ const resultObj = result;
392
+ if (operation === 'list' && resultObj?.tasks) {
393
+ result = resultObj.tasks; // Task list returns object with 'tasks' array
394
+ }
395
+ if (Array.isArray(result)) {
396
+ for (const item of result) {
397
+ // Standard 2026: Direct Entity Link
398
+ const taskItem = item;
399
+ const credentials = await this.getCredentials('bitrix24Api');
400
+ const domain = credentials?.webhookUrl?.split('/rest')[0];
401
+ if (domain && taskItem.id) { // Tasks use lower case 'id' usually in recent API, check response
402
+ taskItem.url = `${domain}/company/personal/user/${taskItem.responsibleId || 0}/tasks/task/view/${taskItem.id}/`;
403
+ }
404
+ returnData.push({
405
+ json: taskItem,
406
+ pairedItem: { item: i },
407
+ });
408
+ }
409
+ }
410
+ else {
411
+ const item = result;
412
+ // Standard 2026: Direct Entity Link
413
+ if (item && (item.id || item.task?.id)) {
414
+ const credentials = await this.getCredentials('bitrix24Api');
415
+ const domain = credentials?.webhookUrl?.split('/rest')[0];
416
+ const taskId = item.id || item.task?.id || body.taskId;
417
+ // URL requires user ID, but we might not have it. Generic link?
418
+ // /company/personal/user/0/tasks/task/view/ID/ redirects mostly
419
+ if (domain && taskId) {
420
+ item.url = `${domain}/company/personal/user/0/tasks/task/view/${taskId}/`;
421
+ }
422
+ }
423
+ returnData.push({
424
+ json: item,
425
+ pairedItem: { item: i },
426
+ });
427
+ }
428
+ }
429
+ catch (error) {
430
+ if (this.continueOnFail()) {
431
+ const err = error;
432
+ returnData.push({
433
+ json: { error: err.message },
434
+ pairedItem: { item: i },
435
+ });
436
+ continue;
437
+ }
438
+ throw error;
439
+ }
440
+ }
441
+ return [returnData];
442
+ }
443
+ }
444
+ exports.Bitrix24Task = Bitrix24Task;