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,406 @@
1
+ "use strict";
2
+ /**
3
+ * Bitrix24 Lists — Нода универсальных списков
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.Bitrix24Lists = void 0;
17
+ const Helpers_1 = require("../Bitrix24/Helpers");
18
+ class Bitrix24Lists {
19
+ constructor() {
20
+ this.description = {
21
+ displayName: 'Bitrix24 Списки',
22
+ name: 'bitrix24Lists',
23
+ icon: 'file:bitrix24.svg',
24
+ group: ['transform'],
25
+ version: 1,
26
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
27
+ description: 'Управление универсальными списками и их элементами',
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: 'Resource',
42
+ name: 'resource',
43
+ type: 'options',
44
+ noDataExpression: true,
45
+ options: [
46
+ {
47
+ name: 'Element',
48
+ value: 'element',
49
+ description: 'List items',
50
+ },
51
+ {
52
+ name: 'List',
53
+ value: 'list',
54
+ description: 'List structure (IBlock)',
55
+ },
56
+ {
57
+ name: 'Section',
58
+ value: 'section',
59
+ description: 'List folders/sections',
60
+ },
61
+ {
62
+ name: 'Field',
63
+ value: 'field',
64
+ description: 'List fields/properties',
65
+ },
66
+ ],
67
+ default: 'element',
68
+ required: true,
69
+ },
70
+ {
71
+ displayName: 'Operation',
72
+ name: 'operation',
73
+ type: 'options',
74
+ noDataExpression: true,
75
+ options: [
76
+ // Element
77
+ {
78
+ name: 'Get',
79
+ value: 'get',
80
+ action: 'Get an element',
81
+ displayOptions: {
82
+ show: {
83
+ resource: ['element', 'list', 'field'],
84
+ },
85
+ },
86
+ },
87
+ {
88
+ name: 'List',
89
+ value: 'list',
90
+ action: 'List elements',
91
+ displayOptions: {
92
+ show: {
93
+ resource: ['element', 'list', 'section', 'field'],
94
+ },
95
+ },
96
+ },
97
+ {
98
+ name: 'Create',
99
+ value: 'create',
100
+ action: 'Create an element',
101
+ displayOptions: {
102
+ show: {
103
+ resource: ['element', 'section'],
104
+ },
105
+ },
106
+ },
107
+ {
108
+ name: 'Update',
109
+ value: 'update',
110
+ action: 'Update an element',
111
+ displayOptions: {
112
+ show: {
113
+ resource: ['element', 'section'],
114
+ },
115
+ },
116
+ },
117
+ {
118
+ name: 'Delete',
119
+ value: 'delete',
120
+ action: 'Delete an element',
121
+ displayOptions: {
122
+ show: {
123
+ resource: ['element', 'section'],
124
+ },
125
+ },
126
+ },
127
+ ],
128
+ default: 'list',
129
+ required: true,
130
+ },
131
+ {
132
+ displayName: 'Group Type',
133
+ name: 'groupType',
134
+ type: 'options',
135
+ options: [
136
+ { name: 'Lists (Default)', value: 'lists' },
137
+ { name: 'Bitrix Processes', value: 'bitrix_processes' },
138
+ { name: 'Social Network', value: 'lists_socnet' },
139
+ ],
140
+ default: 'lists',
141
+ description: 'IBLOCK_TYPE_ID parameter',
142
+ required: true,
143
+ },
144
+ {
145
+ displayName: 'List ID (IBlock ID)',
146
+ name: 'iblockId',
147
+ type: 'string',
148
+ default: '',
149
+ required: true,
150
+ displayOptions: {
151
+ show: {
152
+ resource: ['element', 'section', 'field'],
153
+ },
154
+ },
155
+ description: 'ID of the List (Information Block)',
156
+ },
157
+ {
158
+ displayName: 'Element ID',
159
+ name: 'elementId',
160
+ type: 'string',
161
+ default: '',
162
+ required: true,
163
+ displayOptions: {
164
+ show: {
165
+ resource: ['element'],
166
+ operation: ['get', 'update', 'delete'],
167
+ },
168
+ },
169
+ },
170
+ {
171
+ displayName: 'Section ID',
172
+ name: 'sectionId',
173
+ type: 'string',
174
+ default: '',
175
+ required: true,
176
+ displayOptions: {
177
+ show: {
178
+ resource: ['section'],
179
+ operation: ['update', 'delete'],
180
+ },
181
+ },
182
+ },
183
+ {
184
+ displayName: 'Field ID',
185
+ name: 'fieldId',
186
+ type: 'string',
187
+ default: '',
188
+ required: true,
189
+ displayOptions: {
190
+ show: {
191
+ resource: ['field'],
192
+ operation: ['get'],
193
+ },
194
+ },
195
+ },
196
+ // Create/Update Fields
197
+ {
198
+ displayName: 'Name',
199
+ name: 'name',
200
+ type: 'string',
201
+ default: '',
202
+ displayOptions: {
203
+ show: {
204
+ resource: ['element', 'section'],
205
+ operation: ['create'],
206
+ },
207
+ },
208
+ required: true,
209
+ },
210
+ {
211
+ displayName: 'Fields JSON',
212
+ name: 'fieldsJson',
213
+ type: 'json',
214
+ default: '{}',
215
+ description: 'Fields for the element (PROPERTY_VALUES)',
216
+ displayOptions: {
217
+ show: {
218
+ resource: ['element'],
219
+ operation: ['create', 'update'],
220
+ },
221
+ },
222
+ },
223
+ // List Options
224
+ {
225
+ displayName: 'Return All',
226
+ name: 'returnAll',
227
+ type: 'boolean',
228
+ default: false,
229
+ displayOptions: {
230
+ show: {
231
+ operation: ['list'],
232
+ },
233
+ },
234
+ },
235
+ {
236
+ displayName: 'Limit',
237
+ name: 'limit',
238
+ type: 'number',
239
+ default: 50,
240
+ displayOptions: {
241
+ show: {
242
+ operation: ['list'],
243
+ returnAll: [false],
244
+ },
245
+ },
246
+ },
247
+ {
248
+ displayName: 'Filter JSON',
249
+ name: 'filterJson',
250
+ type: 'json',
251
+ default: '{}',
252
+ displayOptions: {
253
+ show: {
254
+ operation: ['list'],
255
+ },
256
+ },
257
+ },
258
+ ],
259
+ };
260
+ }
261
+ async execute() {
262
+ const items = this.getInputData();
263
+ const returnData = [];
264
+ const resource = this.getNodeParameter('resource', 0);
265
+ const operation = this.getNodeParameter('operation', 0);
266
+ for (let i = 0; i < items.length; i++) {
267
+ try {
268
+ const groupType = this.getNodeParameter('groupType', i, 'lists');
269
+ let iblockId = '';
270
+ try {
271
+ iblockId = this.getNodeParameter('iblockId', i);
272
+ }
273
+ catch (e) { }
274
+ if (resource === 'list') {
275
+ if (operation === 'list') {
276
+ const response = await Helpers_1.bitrixRequestWithRetry.call(this, 'POST', 'lists.get.json', { IBLOCK_TYPE_ID: groupType });
277
+ const results = response.result || [];
278
+ // Standard list filtering handled manually or by API? lists.get doesn't clearly state filter support
279
+ // But usually lists are few.
280
+ for (const item of results) {
281
+ returnData.push({ json: item, pairedItem: { item: i } });
282
+ }
283
+ }
284
+ if (operation === 'get') {
285
+ // lists.get with filter? No direct 'get' by ID in docs usually, but we can filter list
286
+ // Or maybe lists.get supports ID? docs say IBLOCK_ID is param.
287
+ const response = await Helpers_1.bitrixRequestWithRetry.call(this, 'POST', 'lists.get.json', { IBLOCK_TYPE_ID: groupType, IBLOCK_ID: iblockId });
288
+ const results = response.result || [];
289
+ if (results.length > 0) {
290
+ returnData.push({ json: results[0], pairedItem: { item: i } });
291
+ }
292
+ }
293
+ }
294
+ if (resource === 'element') {
295
+ if (operation === 'list') {
296
+ const returnAll = this.getNodeParameter('returnAll', i);
297
+ const filterJson = this.getNodeParameter('filterJson', i, '{}');
298
+ let filter = {};
299
+ try {
300
+ filter = JSON.parse(filterJson);
301
+ }
302
+ catch (e) { }
303
+ const body = {
304
+ IBLOCK_TYPE_ID: groupType,
305
+ IBLOCK_ID: iblockId,
306
+ FILTER: filter
307
+ };
308
+ // lists.element.get
309
+ if (returnAll) {
310
+ let start = 0;
311
+ let hasMore = true;
312
+ while (hasMore) {
313
+ body.start = start;
314
+ const response = await Helpers_1.bitrixRequestWithRetry.call(this, 'POST', 'lists.element.get.json', body);
315
+ const results = response.result || [];
316
+ if (results.length === 0) {
317
+ hasMore = false;
318
+ }
319
+ else {
320
+ for (const item of results) {
321
+ returnData.push({ json: item, pairedItem: { item: i } });
322
+ }
323
+ start += results.length;
324
+ if (results.length < 50)
325
+ hasMore = false;
326
+ }
327
+ }
328
+ }
329
+ else {
330
+ const limit = this.getNodeParameter('limit', i);
331
+ // Does lists.element.get support limit? Docs usually imply 'nPageSize' or similar,
332
+ // but Bitrix standard is start/next often.
333
+ // If no explicit limit param in method, we slice.
334
+ // lists.element.get typically returns 50 by default.
335
+ const response = await Helpers_1.bitrixRequestWithRetry.call(this, 'POST', 'lists.element.get.json', body);
336
+ let results = response.result || [];
337
+ if (limit < results.length)
338
+ results = results.slice(0, limit);
339
+ for (const item of results) {
340
+ returnData.push({ json: item, pairedItem: { item: i } });
341
+ }
342
+ }
343
+ }
344
+ if (operation === 'create') {
345
+ const name = this.getNodeParameter('name', i);
346
+ const fieldsJson = this.getNodeParameter('fieldsJson', i, '{}');
347
+ const fields = JSON.parse(fieldsJson);
348
+ fields.NAME = name;
349
+ const body = {
350
+ IBLOCK_TYPE_ID: groupType,
351
+ IBLOCK_ID: iblockId,
352
+ ELEMENT_CODE: 'element_' + Date.now(), // Auto-gen code often required
353
+ FIELDS: fields
354
+ };
355
+ const response = await Helpers_1.bitrixRequestWithRetry.call(this, 'POST', 'lists.element.add.json', body);
356
+ // Returns ID usually
357
+ returnData.push({ json: { id: response.result }, pairedItem: { item: i } });
358
+ }
359
+ if (operation === 'get') {
360
+ const elementId = this.getNodeParameter('elementId', i);
361
+ const body = { IBLOCK_TYPE_ID: groupType, IBLOCK_ID: iblockId, ELEMENT_ID: elementId };
362
+ // lists.element.get with filter ID? or directly?
363
+ // Docs: lists.element.get accepts FILTER: { ID: val }
364
+ body.FILTER = { ID: elementId };
365
+ const response = await Helpers_1.bitrixRequestWithRetry.call(this, 'POST', 'lists.element.get.json', body);
366
+ const results = response.result || [];
367
+ if (results.length > 0)
368
+ returnData.push({ json: results[0], pairedItem: { item: i } });
369
+ }
370
+ if (operation === 'delete') {
371
+ const elementId = this.getNodeParameter('elementId', i);
372
+ const body = { IBLOCK_TYPE_ID: groupType, IBLOCK_ID: iblockId, ELEMENT_ID: elementId };
373
+ const response = await Helpers_1.bitrixRequestWithRetry.call(this, 'POST', 'lists.element.delete.json', body);
374
+ returnData.push({ json: { success: true, result: response.result }, pairedItem: { item: i } });
375
+ }
376
+ }
377
+ if (resource === 'field') {
378
+ if (operation === 'list') {
379
+ const body = { IBLOCK_TYPE_ID: groupType, IBLOCK_ID: iblockId };
380
+ const response = await Helpers_1.bitrixRequestWithRetry.call(this, 'POST', 'lists.field.get.json', body);
381
+ const results = response.result;
382
+ // Response is object { FIELD_ID: { ... }, ... } or array?
383
+ // Usually object map.
384
+ if (results) {
385
+ // Converts object map to array
386
+ Object.keys(results).forEach(key => {
387
+ // @ts-ignore
388
+ const field = results[key];
389
+ returnData.push({ json: field, pairedItem: { item: i } });
390
+ });
391
+ }
392
+ }
393
+ }
394
+ }
395
+ catch (error) {
396
+ if (this.continueOnFail()) {
397
+ returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
398
+ continue;
399
+ }
400
+ throw error;
401
+ }
402
+ }
403
+ return [returnData];
404
+ }
405
+ }
406
+ exports.Bitrix24Lists = Bitrix24Lists;