@aiteza/n8n-nodes-aiteza 0.1.1 → 0.2.1

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.
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.Aiteza = void 0;
7
+ const n8n_workflow_1 = require("n8n-workflow");
8
+ const form_data_1 = __importDefault(require("form-data"));
4
9
  const GenericFunctions_1 = require("./GenericFunctions");
5
10
  class Aiteza {
6
11
  description = {
@@ -18,9 +23,43 @@ class Aiteza {
18
23
  {
19
24
  name: 'aitezaOAuth2Api',
20
25
  required: true,
26
+ displayOptions: {
27
+ show: { authentication: ['credentials'] },
28
+ },
21
29
  },
22
30
  ],
23
31
  properties: [
32
+ // ------------------------------------------------------------------
33
+ // Authentication mode
34
+ // ------------------------------------------------------------------
35
+ {
36
+ displayName: 'Authentication',
37
+ name: 'authentication',
38
+ type: 'options',
39
+ options: [
40
+ {
41
+ name: 'OAuth2 Credentials',
42
+ value: 'credentials',
43
+ description: 'Use configured AITEZA OAuth2 credentials',
44
+ },
45
+ {
46
+ name: 'From AITEZA Trigger',
47
+ value: 'trigger',
48
+ description: 'Use the auth token passed by an upstream AITEZA Trigger node (acts on behalf of the calling user)',
49
+ },
50
+ ],
51
+ default: 'credentials',
52
+ },
53
+ {
54
+ displayName: 'AITEZA Base URL',
55
+ name: 'baseUrl',
56
+ type: 'string',
57
+ required: true,
58
+ default: '',
59
+ placeholder: 'https://aiteza.example.com',
60
+ displayOptions: { show: { authentication: ['trigger'] } },
61
+ description: 'Base URL of the AITEZA backend (without trailing slash). Required when using trigger authentication since no credentials are configured.',
62
+ },
24
63
  // ------------------------------------------------------------------
25
64
  // Resource
26
65
  // ------------------------------------------------------------------
@@ -32,9 +71,13 @@ class Aiteza {
32
71
  options: [
33
72
  { name: 'Chat', value: 'chat' },
34
73
  { name: 'Dataroom', value: 'dataroom' },
74
+ { name: 'Dataroom Group', value: 'dataroomGroup' },
75
+ { name: 'Dataroom Member', value: 'dataroomMember' },
35
76
  { name: 'File', value: 'file' },
77
+ { name: 'Identity', value: 'identity' },
36
78
  { name: 'Image', value: 'image' },
37
79
  { name: 'Model', value: 'model' },
80
+ { name: 'Search', value: 'search' },
38
81
  { name: 'Web Source', value: 'webSource' },
39
82
  ],
40
83
  default: 'dataroom',
@@ -52,13 +95,21 @@ class Aiteza {
52
95
  { name: 'Create', value: 'create', action: 'Create a dataroom' },
53
96
  { name: 'Delete', value: 'delete', action: 'Delete datarooms' },
54
97
  { name: 'Get', value: 'get', action: 'Get a dataroom' },
98
+ { name: 'Get Chats', value: 'getChats', action: 'Get chats connected to a dataroom' },
55
99
  { name: 'Get Children', value: 'getChildren', action: 'Get children of a dataroom' },
100
+ { name: 'Get Connected', value: 'getConnected', action: 'Get connected datarooms' },
101
+ { name: 'Get Models', value: 'getModels', action: 'Get models available in a dataroom' },
102
+ { name: 'Get Recent', value: 'getRecent', action: 'Get recently used datarooms' },
103
+ { name: 'Get Starred', value: 'getStarred', action: 'Get starred datarooms' },
56
104
  { name: 'Search', value: 'search', action: 'Search datarooms by name' },
105
+ { name: 'Set Connected', value: 'setConnected', action: 'Set connected datarooms' },
106
+ { name: 'Star', value: 'star', action: 'Star a dataroom' },
107
+ { name: 'Unstar', value: 'unstar', action: 'Unstar a dataroom' },
57
108
  { name: 'Update', value: 'update', action: 'Update a dataroom' },
58
109
  ],
59
110
  default: 'get',
60
111
  },
61
- // Dataroom → Get / Update
112
+ // Dataroom → Get / Update / Star / Unstar / Get Connected / Set Connected / Get Chats / Get Models
62
113
  {
63
114
  displayName: 'Dataroom Name or ID',
64
115
  name: 'dataroomId',
@@ -66,7 +117,7 @@ class Aiteza {
66
117
  typeOptions: { loadOptionsMethod: 'getDatarooms' },
67
118
  required: true,
68
119
  default: '',
69
- displayOptions: { show: { resource: ['dataroom'], operation: ['get', 'update'] } },
120
+ displayOptions: { show: { resource: ['dataroom'], operation: ['get', 'update', 'star', 'unstar', 'getConnected', 'setConnected', 'getChats', 'getModels'] } },
70
121
  description: 'The dataroom to operate on. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
71
122
  },
72
123
  // Dataroom → Get Children
@@ -209,6 +260,215 @@ class Aiteza {
209
260
  displayOptions: { show: { resource: ['dataroom'], operation: ['delete'] } },
210
261
  description: 'Comma-separated list of dataroom IDs to delete',
211
262
  },
263
+ // Dataroom → Set Connected
264
+ {
265
+ displayName: 'Connected Dataroom IDs',
266
+ name: 'connectedDataroomIds',
267
+ type: 'string',
268
+ required: true,
269
+ default: '',
270
+ displayOptions: { show: { resource: ['dataroom'], operation: ['setConnected'] } },
271
+ description: 'Comma-separated list of dataroom IDs to set as default connected datarooms',
272
+ },
273
+ // Dataroom → Get Chats pagination
274
+ {
275
+ displayName: 'Additional Fields',
276
+ name: 'additionalFields',
277
+ type: 'collection',
278
+ placeholder: 'Add Field',
279
+ default: {},
280
+ displayOptions: { show: { resource: ['dataroom'], operation: ['getChats'] } },
281
+ options: [
282
+ {
283
+ displayName: 'Page',
284
+ name: 'page',
285
+ type: 'number',
286
+ default: 0,
287
+ description: 'Page number (0-based)',
288
+ },
289
+ {
290
+ displayName: 'Size',
291
+ name: 'size',
292
+ type: 'number',
293
+ default: 20,
294
+ description: 'Number of items per page',
295
+ },
296
+ {
297
+ displayName: 'Query',
298
+ name: 'q',
299
+ type: 'string',
300
+ default: '',
301
+ description: 'Filter chats by name (case-insensitive)',
302
+ },
303
+ ],
304
+ },
305
+ // Dataroom → Get Starred
306
+ {
307
+ displayName: 'Additional Fields',
308
+ name: 'additionalFields',
309
+ type: 'collection',
310
+ placeholder: 'Add Field',
311
+ default: {},
312
+ displayOptions: { show: { resource: ['dataroom'], operation: ['getStarred'] } },
313
+ options: [
314
+ {
315
+ displayName: 'Name Filter',
316
+ name: 'q',
317
+ type: 'string',
318
+ default: '',
319
+ description: 'Filter by name (case-insensitive)',
320
+ },
321
+ {
322
+ displayName: 'Sort By',
323
+ name: 'sortBy',
324
+ type: 'string',
325
+ default: '',
326
+ description: 'Field name to sort by',
327
+ },
328
+ {
329
+ displayName: 'Sort Order',
330
+ name: 'sortOrder',
331
+ type: 'options',
332
+ options: [
333
+ { name: 'Ascending', value: 'ASC' },
334
+ { name: 'Descending', value: 'DESC' },
335
+ ],
336
+ default: 'ASC',
337
+ },
338
+ ],
339
+ },
340
+ // ==================================================================
341
+ // DATAROOM MEMBER
342
+ // ==================================================================
343
+ {
344
+ displayName: 'Operation',
345
+ name: 'operation',
346
+ type: 'options',
347
+ noDataExpression: true,
348
+ displayOptions: { show: { resource: ['dataroomMember'] } },
349
+ options: [
350
+ { name: 'Add', value: 'add', action: 'Add a member to a dataroom' },
351
+ { name: 'Get Many', value: 'getMany', action: 'Get all members of a dataroom' },
352
+ { name: 'Remove', value: 'remove', action: 'Remove a member from a dataroom' },
353
+ { name: 'Update Role', value: 'updateRole', action: 'Update a member role in a dataroom' },
354
+ ],
355
+ default: 'getMany',
356
+ },
357
+ {
358
+ displayName: 'Dataroom Name or ID',
359
+ name: 'dataroomId',
360
+ type: 'options',
361
+ typeOptions: { loadOptionsMethod: 'getDatarooms' },
362
+ required: true,
363
+ default: '',
364
+ displayOptions: { show: { resource: ['dataroomMember'] } },
365
+ description: 'The dataroom. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
366
+ },
367
+ {
368
+ displayName: 'Search',
369
+ name: 'searchTerm',
370
+ type: 'string',
371
+ default: '',
372
+ displayOptions: { show: { resource: ['dataroomMember'], operation: ['getMany'] } },
373
+ description: 'Optional search term to filter members',
374
+ },
375
+ {
376
+ displayName: 'Usernames',
377
+ name: 'usernames',
378
+ type: 'string',
379
+ required: true,
380
+ default: '',
381
+ displayOptions: { show: { resource: ['dataroomMember'], operation: ['add', 'remove', 'updateRole'] } },
382
+ description: 'Comma-separated list of usernames',
383
+ },
384
+ {
385
+ displayName: 'Role',
386
+ name: 'role',
387
+ type: 'options',
388
+ required: true,
389
+ default: 'viewer',
390
+ displayOptions: { show: { resource: ['dataroomMember'], operation: ['add', 'updateRole'] } },
391
+ options: [
392
+ { name: 'Owner', value: 'owner' },
393
+ { name: 'Editor', value: 'editor' },
394
+ { name: 'Viewer', value: 'viewer' },
395
+ ],
396
+ description: 'Role to assign',
397
+ },
398
+ {
399
+ displayName: 'Inherit to Children',
400
+ name: 'inherit',
401
+ type: 'boolean',
402
+ default: false,
403
+ displayOptions: { show: { resource: ['dataroomMember'], operation: ['add', 'remove', 'updateRole'] } },
404
+ description: 'Whether to inherit this role assignment to all child datarooms',
405
+ },
406
+ // ==================================================================
407
+ // DATAROOM GROUP
408
+ // ==================================================================
409
+ {
410
+ displayName: 'Operation',
411
+ name: 'operation',
412
+ type: 'options',
413
+ noDataExpression: true,
414
+ displayOptions: { show: { resource: ['dataroomGroup'] } },
415
+ options: [
416
+ { name: 'Add', value: 'add', action: 'Assign a group to a dataroom' },
417
+ { name: 'Get Many', value: 'getMany', action: 'Get groups assigned to a dataroom' },
418
+ { name: 'Remove', value: 'remove', action: 'Remove a group from a dataroom' },
419
+ { name: 'Update Role', value: 'updateRole', action: 'Update group role in a dataroom' },
420
+ ],
421
+ default: 'getMany',
422
+ },
423
+ {
424
+ displayName: 'Dataroom Name or ID',
425
+ name: 'dataroomId',
426
+ type: 'options',
427
+ typeOptions: { loadOptionsMethod: 'getDatarooms' },
428
+ required: true,
429
+ default: '',
430
+ displayOptions: { show: { resource: ['dataroomGroup'] } },
431
+ description: 'The dataroom. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
432
+ },
433
+ {
434
+ displayName: 'Search',
435
+ name: 'searchTerm',
436
+ type: 'string',
437
+ default: '',
438
+ displayOptions: { show: { resource: ['dataroomGroup'], operation: ['getMany'] } },
439
+ description: 'Optional search term to filter groups',
440
+ },
441
+ {
442
+ displayName: 'Group Path',
443
+ name: 'groupPath',
444
+ type: 'string',
445
+ required: true,
446
+ default: '',
447
+ displayOptions: { show: { resource: ['dataroomGroup'], operation: ['add', 'remove', 'updateRole'] } },
448
+ description: 'The group path/name to assign or remove',
449
+ },
450
+ {
451
+ displayName: 'Role',
452
+ name: 'role',
453
+ type: 'options',
454
+ required: true,
455
+ default: 'viewer',
456
+ displayOptions: { show: { resource: ['dataroomGroup'], operation: ['add', 'updateRole'] } },
457
+ options: [
458
+ { name: 'Owner', value: 'owner' },
459
+ { name: 'Editor', value: 'editor' },
460
+ { name: 'Viewer', value: 'viewer' },
461
+ ],
462
+ description: 'Role to assign to the group',
463
+ },
464
+ {
465
+ displayName: 'Inherit to Children',
466
+ name: 'inherit',
467
+ type: 'boolean',
468
+ default: false,
469
+ displayOptions: { show: { resource: ['dataroomGroup'], operation: ['add', 'remove', 'updateRole'] } },
470
+ description: 'Whether to apply changes to child datarooms',
471
+ },
212
472
  // ==================================================================
213
473
  // FILE
214
474
  // ==================================================================
@@ -221,13 +481,20 @@ class Aiteza {
221
481
  options: [
222
482
  { name: 'Assign to Dataroom', value: 'assign', action: 'Assign a standalone file to a dataroom' },
223
483
  { name: 'Delete', value: 'delete', action: 'Delete a file from a dataroom' },
484
+ { name: 'Delete All (Dataroom)', value: 'deleteAllDataroom', action: 'Delete all files from a dataroom' },
224
485
  { name: 'Delete Standalone', value: 'deleteStandalone', action: 'Delete a standalone file' },
225
486
  { name: 'Get', value: 'get', action: 'Get a file from a dataroom' },
487
+ { name: 'Get Chunks', value: 'getChunks', action: 'Get chunks of a standalone file' },
488
+ { name: 'Get Chunks (Dataroom)', value: 'getChunksDataroom', action: 'Get chunks of a dataroom file' },
226
489
  { name: 'Get Content', value: 'getContent', action: 'Get processed text content of a standalone file' },
227
490
  { name: 'Get Many', value: 'getMany', action: 'Get files in a dataroom' },
228
491
  { name: 'Get Many Standalone', value: 'getManyStandalone', action: 'Get standalone files' },
229
492
  { name: 'Get Metadata', value: 'getMetadata', action: 'Get metadata of a standalone file' },
493
+ { name: 'Get Original URL', value: 'getOriginalUrl', action: 'Get original file download URL' },
494
+ { name: 'Get Original URL (Dataroom)', value: 'getOriginalUrlDataroom', action: 'Get original file download URL from dataroom' },
230
495
  { name: 'Get Status', value: 'getStatus', action: 'Get file processing status' },
496
+ { name: 'Move', value: 'move', action: 'Move a file to another dataroom' },
497
+ { name: 'Reprocess', value: 'reprocess', action: 'Reprocess a file in a dataroom' },
231
498
  { name: 'Upload', value: 'upload', action: 'Upload a file to a dataroom' },
232
499
  { name: 'Upload Standalone', value: 'uploadStandalone', action: 'Upload a standalone file' },
233
500
  ],
@@ -242,7 +509,7 @@ class Aiteza {
242
509
  required: true,
243
510
  default: '',
244
511
  displayOptions: {
245
- show: { resource: ['file'], operation: ['getMany', 'get', 'delete', 'upload'] },
512
+ show: { resource: ['file'], operation: ['getMany', 'get', 'delete', 'upload', 'deleteAllDataroom', 'reprocess', 'move', 'getOriginalUrlDataroom', 'getChunksDataroom'] },
246
513
  },
247
514
  description: 'The dataroom. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
248
515
  },
@@ -254,7 +521,7 @@ class Aiteza {
254
521
  typeOptions: { loadOptionsMethod: 'getFilesInDataroom', loadOptionsDependsOn: ['dataroomId'] },
255
522
  required: true,
256
523
  default: '',
257
- displayOptions: { show: { resource: ['file'], operation: ['get', 'delete'] } },
524
+ displayOptions: { show: { resource: ['file'], operation: ['get', 'delete', 'reprocess', 'move', 'getOriginalUrlDataroom', 'getChunksDataroom'] } },
258
525
  description: 'The file. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
259
526
  },
260
527
  // File → File ID (standalone operations)
@@ -266,7 +533,7 @@ class Aiteza {
266
533
  required: true,
267
534
  default: '',
268
535
  displayOptions: {
269
- show: { resource: ['file'], operation: ['getStatus', 'getMetadata', 'getContent', 'deleteStandalone', 'assign'] },
536
+ show: { resource: ['file'], operation: ['getStatus', 'getMetadata', 'getContent', 'deleteStandalone', 'assign', 'getOriginalUrl', 'getChunks'] },
270
537
  },
271
538
  description: 'The standalone file. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
272
539
  },
@@ -278,8 +545,8 @@ class Aiteza {
278
545
  typeOptions: { loadOptionsMethod: 'getDatarooms' },
279
546
  required: true,
280
547
  default: '',
281
- displayOptions: { show: { resource: ['file'], operation: ['assign'] } },
282
- description: 'The dataroom to assign the file to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
548
+ displayOptions: { show: { resource: ['file'], operation: ['assign', 'move'] } },
549
+ description: 'The dataroom to assign/move the file to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
283
550
  },
284
551
  // File → Get Many (pagination)
285
552
  {
@@ -330,6 +597,31 @@ class Aiteza {
330
597
  },
331
598
  ],
332
599
  },
600
+ // File → Get Chunks pagination
601
+ {
602
+ displayName: 'Additional Fields',
603
+ name: 'additionalFields',
604
+ type: 'collection',
605
+ placeholder: 'Add Field',
606
+ default: {},
607
+ displayOptions: { show: { resource: ['file'], operation: ['getChunks', 'getChunksDataroom'] } },
608
+ options: [
609
+ {
610
+ displayName: 'Page',
611
+ name: 'page',
612
+ type: 'number',
613
+ default: 0,
614
+ description: 'Page number (0-based)',
615
+ },
616
+ {
617
+ displayName: 'Size',
618
+ name: 'size',
619
+ type: 'number',
620
+ default: 20,
621
+ description: 'Number of items per page',
622
+ },
623
+ ],
624
+ },
333
625
  // File → Upload / Upload Standalone
334
626
  {
335
627
  displayName: 'Binary Property',
@@ -346,7 +638,7 @@ class Aiteza {
346
638
  type: 'options',
347
639
  required: true,
348
640
  default: 'DOCLING',
349
- displayOptions: { show: { resource: ['file'], operation: ['upload', 'uploadStandalone'] } },
641
+ displayOptions: { show: { resource: ['file'], operation: ['upload', 'uploadStandalone', 'reprocess'] } },
350
642
  options: [
351
643
  { name: 'TIKA', value: 'TIKA' },
352
644
  { name: 'DOCLING', value: 'DOCLING' },
@@ -360,7 +652,7 @@ class Aiteza {
360
652
  name: 'vlmModel',
361
653
  type: 'string',
362
654
  default: '',
363
- displayOptions: { show: { resource: ['file'], operation: ['upload', 'uploadStandalone'], processingPipeline: ['VLM'] } },
655
+ displayOptions: { show: { resource: ['file'], operation: ['upload', 'uploadStandalone', 'reprocess'], processingPipeline: ['VLM'] } },
364
656
  description: 'VLM model name to use (required when pipeline is VLM)',
365
657
  },
366
658
  // ==================================================================
@@ -375,12 +667,16 @@ class Aiteza {
375
667
  options: [
376
668
  { name: 'Assign to Dataroom', value: 'assign', action: 'Assign a standalone image to a dataroom' },
377
669
  { name: 'Delete (Dataroom)', value: 'deleteDataroom', action: 'Delete an image from a dataroom' },
670
+ { name: 'Delete All (Dataroom)', value: 'deleteAllDataroom', action: 'Delete all images from a dataroom' },
378
671
  { name: 'Delete Standalone', value: 'deleteStandalone', action: 'Delete a standalone image' },
379
672
  { name: 'Get (Dataroom)', value: 'getDataroom', action: 'Get an image from a dataroom' },
380
673
  { name: 'Get Many (Dataroom)', value: 'getManyDataroom', action: 'Get images in a dataroom' },
381
674
  { name: 'Get Many Standalone', value: 'getManyStandalone', action: 'Get standalone images' },
382
675
  { name: 'Get Metadata', value: 'getMetadata', action: 'Get metadata of a standalone image' },
676
+ { name: 'Get Original URL', value: 'getOriginalUrl', action: 'Get original image download URL' },
677
+ { name: 'Get Original URL (Dataroom)', value: 'getOriginalUrlDataroom', action: 'Get original image download URL from dataroom' },
383
678
  { name: 'Get Status', value: 'getStatus', action: 'Get image processing status' },
679
+ { name: 'Move', value: 'move', action: 'Move an image to another dataroom' },
384
680
  { name: 'Upload (Dataroom)', value: 'uploadDataroom', action: 'Upload an image to a dataroom' },
385
681
  { name: 'Upload Standalone', value: 'uploadStandalone', action: 'Upload a standalone image' },
386
682
  ],
@@ -395,7 +691,7 @@ class Aiteza {
395
691
  required: true,
396
692
  default: '',
397
693
  displayOptions: {
398
- show: { resource: ['image'], operation: ['getManyDataroom', 'getDataroom', 'deleteDataroom', 'uploadDataroom'] },
694
+ show: { resource: ['image'], operation: ['getManyDataroom', 'getDataroom', 'deleteDataroom', 'uploadDataroom', 'deleteAllDataroom', 'move', 'getOriginalUrlDataroom'] },
399
695
  },
400
696
  description: 'The dataroom. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
401
697
  },
@@ -407,7 +703,7 @@ class Aiteza {
407
703
  typeOptions: { loadOptionsMethod: 'getImagesInDataroom', loadOptionsDependsOn: ['dataroomId'] },
408
704
  required: true,
409
705
  default: '',
410
- displayOptions: { show: { resource: ['image'], operation: ['getDataroom', 'deleteDataroom'] } },
706
+ displayOptions: { show: { resource: ['image'], operation: ['getDataroom', 'deleteDataroom', 'move', 'getOriginalUrlDataroom'] } },
411
707
  description: 'The image. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
412
708
  },
413
709
  // Image → Image ID (standalone)
@@ -419,11 +715,11 @@ class Aiteza {
419
715
  required: true,
420
716
  default: '',
421
717
  displayOptions: {
422
- show: { resource: ['image'], operation: ['getMetadata', 'getStatus', 'deleteStandalone', 'assign'] },
718
+ show: { resource: ['image'], operation: ['getMetadata', 'getStatus', 'deleteStandalone', 'assign', 'getOriginalUrl'] },
423
719
  },
424
720
  description: 'The standalone image. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
425
721
  },
426
- // Image → Assign target
722
+ // Image → Assign/Move target
427
723
  {
428
724
  displayName: 'Target Dataroom Name or ID',
429
725
  name: 'targetDataroomId',
@@ -431,8 +727,8 @@ class Aiteza {
431
727
  typeOptions: { loadOptionsMethod: 'getDatarooms' },
432
728
  required: true,
433
729
  default: '',
434
- displayOptions: { show: { resource: ['image'], operation: ['assign'] } },
435
- description: 'The dataroom to assign the image to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
730
+ displayOptions: { show: { resource: ['image'], operation: ['assign', 'move'] } },
731
+ description: 'The dataroom to assign/move the image to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
436
732
  },
437
733
  // Image → Get Many pagination
438
734
  {
@@ -504,8 +800,11 @@ class Aiteza {
504
800
  options: [
505
801
  { name: 'Add', value: 'add', action: 'Add a web source to a dataroom' },
506
802
  { name: 'Delete', value: 'delete', action: 'Delete a web source' },
803
+ { name: 'Delete All', value: 'deleteAll', action: 'Delete all web sources from a dataroom' },
507
804
  { name: 'Get', value: 'get', action: 'Get a web source' },
508
805
  { name: 'Get Many', value: 'getMany', action: 'Get web sources in a dataroom' },
806
+ { name: 'Move', value: 'move', action: 'Move a web source to another dataroom' },
807
+ { name: 'Rescan', value: 'rescan', action: 'Rescan a web source' },
509
808
  ],
510
809
  default: 'getMany',
511
810
  },
@@ -519,7 +818,7 @@ class Aiteza {
519
818
  displayOptions: { show: { resource: ['webSource'] } },
520
819
  description: 'The dataroom. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
521
820
  },
522
- // Web Source → Get / Delete
821
+ // Web Source → Get / Delete / Rescan / Move
523
822
  {
524
823
  displayName: 'Web Source Name or ID',
525
824
  name: 'webSourceId',
@@ -527,9 +826,20 @@ class Aiteza {
527
826
  typeOptions: { loadOptionsMethod: 'getWebSourcesInDataroom', loadOptionsDependsOn: ['dataroomId'] },
528
827
  required: true,
529
828
  default: '',
530
- displayOptions: { show: { resource: ['webSource'], operation: ['get', 'delete'] } },
829
+ displayOptions: { show: { resource: ['webSource'], operation: ['get', 'delete', 'rescan', 'move'] } },
531
830
  description: 'The web source. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
532
831
  },
832
+ // Web Source → Move target
833
+ {
834
+ displayName: 'Target Dataroom Name or ID',
835
+ name: 'targetDataroomId',
836
+ type: 'options',
837
+ typeOptions: { loadOptionsMethod: 'getDatarooms' },
838
+ required: true,
839
+ default: '',
840
+ displayOptions: { show: { resource: ['webSource'], operation: ['move'] } },
841
+ description: 'The target dataroom. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
842
+ },
533
843
  // Web Source → Add
534
844
  {
535
845
  displayName: 'URL',
@@ -578,6 +888,35 @@ class Aiteza {
578
888
  },
579
889
  ],
580
890
  },
891
+ // Web Source → Rescan
892
+ {
893
+ displayName: 'Rescan Options',
894
+ name: 'rescanOptions',
895
+ type: 'collection',
896
+ placeholder: 'Add Option',
897
+ default: {},
898
+ displayOptions: { show: { resource: ['webSource'], operation: ['rescan'] } },
899
+ options: [
900
+ {
901
+ displayName: 'Include Subpages',
902
+ name: 'includeSubpages',
903
+ type: 'boolean',
904
+ default: false,
905
+ },
906
+ {
907
+ displayName: 'Max Subpages',
908
+ name: 'maxSubpages',
909
+ type: 'number',
910
+ default: 10,
911
+ },
912
+ {
913
+ displayName: 'Max Depth',
914
+ name: 'maxDepth',
915
+ type: 'number',
916
+ default: 1,
917
+ },
918
+ ],
919
+ },
581
920
  // Web Source → Get Many pagination
582
921
  {
583
922
  displayName: 'Additional Fields',
@@ -601,7 +940,7 @@ class Aiteza {
601
940
  },
602
941
  {
603
942
  displayName: 'Search Term',
604
- name: 'search_term',
943
+ name: 'q',
605
944
  type: 'string',
606
945
  default: '',
607
946
  },
@@ -619,11 +958,16 @@ class Aiteza {
619
958
  options: [
620
959
  { name: 'Create', value: 'create', action: 'Create a chat' },
621
960
  { name: 'Delete', value: 'delete', action: 'Delete a chat' },
961
+ { name: 'Delete Messages', value: 'deleteMessages', action: 'Delete all messages in a chat' },
962
+ { name: 'Estimate Cost', value: 'estimate', action: 'Estimate chat cost' },
622
963
  { name: 'Generate', value: 'generate', action: 'Generate a response in a chat' },
623
964
  { name: 'Get', value: 'get', action: 'Get a chat' },
965
+ { name: 'Get Latest Message', value: 'getLatestMessage', action: 'Get latest message in a chat' },
624
966
  { name: 'Get Many', value: 'getMany', action: 'Get all chats (paginated)' },
967
+ { name: 'Get Message', value: 'getMessage', action: 'Get a specific message' },
625
968
  { name: 'Get Messages', value: 'getMessages', action: 'Get chat messages' },
626
969
  { name: 'Rename', value: 'rename', action: 'Rename a chat' },
970
+ { name: 'Temp Chat', value: 'tempChat', action: 'Ephemeral agentic RAG evaluation' },
627
971
  ],
628
972
  default: 'generate',
629
973
  },
@@ -636,7 +980,7 @@ class Aiteza {
636
980
  displayOptions: { show: { resource: ['chat'], operation: ['create'] } },
637
981
  description: 'Optional name for the chat',
638
982
  },
639
- // Chat → Get / Get Messages / Delete / Generate / Rename
983
+ // Chat → Get / Get Messages / Delete / Generate / Stream / Estimate / Rename / Delete Messages / Get Latest Message / Get Message
640
984
  {
641
985
  displayName: 'Chat Name or ID',
642
986
  name: 'chatId',
@@ -645,10 +989,20 @@ class Aiteza {
645
989
  required: true,
646
990
  default: '',
647
991
  displayOptions: {
648
- show: { resource: ['chat'], operation: ['get', 'getMessages', 'delete', 'generate', 'rename'] },
992
+ show: { resource: ['chat'], operation: ['get', 'getMessages', 'delete', 'generate', 'rename', 'deleteMessages', 'getLatestMessage', 'getMessage'] },
649
993
  },
650
994
  description: 'The chat. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>. Use "new" to auto-create a chat for generate.',
651
995
  },
996
+ // Chat → Get Message
997
+ {
998
+ displayName: 'Message ID',
999
+ name: 'messageId',
1000
+ type: 'string',
1001
+ required: true,
1002
+ default: '',
1003
+ displayOptions: { show: { resource: ['chat'], operation: ['getMessage'] } },
1004
+ description: 'The unique identifier of the message',
1005
+ },
652
1006
  // Chat → Rename
653
1007
  {
654
1008
  displayName: 'New Name',
@@ -682,14 +1036,14 @@ class Aiteza {
682
1036
  },
683
1037
  {
684
1038
  displayName: 'Query',
685
- name: 'query',
1039
+ name: 'q',
686
1040
  type: 'string',
687
1041
  default: '',
688
1042
  description: 'Filter chats by name (case-insensitive)',
689
1043
  },
690
1044
  ],
691
1045
  },
692
- // Chat → Generate
1046
+ // Chat → Generate / Stream / Estimate
693
1047
  {
694
1048
  displayName: 'Prompt',
695
1049
  name: 'prompt',
@@ -697,7 +1051,7 @@ class Aiteza {
697
1051
  required: true,
698
1052
  typeOptions: { rows: 4 },
699
1053
  default: '',
700
- displayOptions: { show: { resource: ['chat'], operation: ['generate'] } },
1054
+ displayOptions: { show: { resource: ['chat'], operation: ['generate', 'estimate'] } },
701
1055
  description: 'The prompt / question to send to the model',
702
1056
  },
703
1057
  {
@@ -707,7 +1061,7 @@ class Aiteza {
707
1061
  typeOptions: { loadOptionsMethod: 'getModels' },
708
1062
  required: true,
709
1063
  default: '',
710
- displayOptions: { show: { resource: ['chat'], operation: ['generate'] } },
1064
+ displayOptions: { show: { resource: ['chat'], operation: ['generate', 'estimate'] } },
711
1065
  description: 'AI model to use. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
712
1066
  },
713
1067
  {
@@ -716,7 +1070,7 @@ class Aiteza {
716
1070
  type: 'collection',
717
1071
  placeholder: 'Add Field',
718
1072
  default: {},
719
- displayOptions: { show: { resource: ['chat'], operation: ['generate'] } },
1073
+ displayOptions: { show: { resource: ['chat'], operation: ['generate', 'estimate'] } },
720
1074
  options: [
721
1075
  {
722
1076
  displayName: 'Connected Dataroom IDs',
@@ -755,49 +1109,253 @@ class Aiteza {
755
1109
  displayName: 'Web Search Enabled',
756
1110
  name: 'webSearchEnabled',
757
1111
  type: 'boolean',
758
- default: true,
1112
+ default: false,
759
1113
  },
760
1114
  {
761
1115
  displayName: 'Agentic Mode',
762
1116
  name: 'agenticMode',
763
1117
  type: 'boolean',
764
- default: false,
1118
+ default: true,
765
1119
  description: 'Whether the LLM autonomously decides which datarooms and files to search',
766
1120
  },
1121
+ {
1122
+ displayName: 'Workflow ID',
1123
+ name: 'workflowId',
1124
+ type: 'string',
1125
+ default: '',
1126
+ description: 'Workflow ID to use for this chat request',
1127
+ },
767
1128
  ],
768
1129
  },
769
- // ==================================================================
770
- // MODEL
771
- // ==================================================================
1130
+ // Chat → Temp Chat
772
1131
  {
773
- displayName: 'Operation',
774
- name: 'operation',
775
- type: 'options',
776
- noDataExpression: true,
777
- displayOptions: { show: { resource: ['model'] } },
778
- options: [
779
- { name: 'Get', value: 'get', action: 'Get a model by ID' },
780
- { name: 'Get Many', value: 'getMany', action: 'Get all models' },
781
- { name: 'Get Processing Models', value: 'getProcessing', action: 'Get available processing pipelines' },
782
- { name: 'Get VLM Models', value: 'getVlm', action: 'Get available VLM models' },
783
- ],
784
- default: 'getMany',
1132
+ displayName: 'Prompt',
1133
+ name: 'prompt',
1134
+ type: 'string',
1135
+ required: true,
1136
+ typeOptions: { rows: 4 },
1137
+ default: '',
1138
+ displayOptions: { show: { resource: ['chat'], operation: ['tempChat'] } },
1139
+ description: 'The prompt/question to evaluate',
785
1140
  },
786
1141
  {
787
1142
  displayName: 'Model Name or ID',
788
- name: 'modelId',
1143
+ name: 'model',
789
1144
  type: 'options',
790
1145
  typeOptions: { loadOptionsMethod: 'getModels' },
791
1146
  required: true,
792
1147
  default: '',
793
- displayOptions: { show: { resource: ['model'], operation: ['get'] } },
794
- description: 'The model. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
1148
+ displayOptions: { show: { resource: ['chat'], operation: ['tempChat'] } },
1149
+ description: 'AI model to use (must support agentic RAG). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
795
1150
  },
796
- ],
797
- };
798
- methods = {
799
- loadOptions: {
800
- getDatarooms: GenericFunctions_1.loadDatarooms,
1151
+ {
1152
+ displayName: 'Additional Fields',
1153
+ name: 'additionalFields',
1154
+ type: 'collection',
1155
+ placeholder: 'Add Field',
1156
+ default: {},
1157
+ displayOptions: { show: { resource: ['chat'], operation: ['tempChat'] } },
1158
+ options: [
1159
+ {
1160
+ displayName: 'Connected Dataroom IDs',
1161
+ name: 'connectedDatarooms',
1162
+ type: 'string',
1163
+ default: '',
1164
+ description: 'Comma-separated dataroom IDs to search',
1165
+ },
1166
+ {
1167
+ displayName: 'File IDs',
1168
+ name: 'fileIds',
1169
+ type: 'string',
1170
+ default: '',
1171
+ description: 'Comma-separated file IDs to use as context',
1172
+ },
1173
+ {
1174
+ displayName: 'Image IDs',
1175
+ name: 'imageIds',
1176
+ type: 'string',
1177
+ default: '',
1178
+ description: 'Comma-separated image IDs to use as context',
1179
+ },
1180
+ {
1181
+ displayName: 'Web Search Enabled',
1182
+ name: 'webSearchEnabled',
1183
+ type: 'boolean',
1184
+ default: false,
1185
+ },
1186
+ {
1187
+ displayName: 'Include Sub-Datarooms',
1188
+ name: 'subDatarooms',
1189
+ type: 'boolean',
1190
+ default: false,
1191
+ },
1192
+ {
1193
+ displayName: 'Include Parent Datarooms',
1194
+ name: 'parentDatarooms',
1195
+ type: 'boolean',
1196
+ default: false,
1197
+ },
1198
+ {
1199
+ displayName: 'Workflow ID',
1200
+ name: 'workflowId',
1201
+ type: 'string',
1202
+ default: '',
1203
+ description: 'Workflow ID to use for this request',
1204
+ },
1205
+ ],
1206
+ },
1207
+ // ==================================================================
1208
+ // MODEL
1209
+ // ==================================================================
1210
+ {
1211
+ displayName: 'Operation',
1212
+ name: 'operation',
1213
+ type: 'options',
1214
+ noDataExpression: true,
1215
+ displayOptions: { show: { resource: ['model'] } },
1216
+ options: [
1217
+ { name: 'Get', value: 'get', action: 'Get a model by ID' },
1218
+ { name: 'Get Many', value: 'getMany', action: 'Get all models' },
1219
+ { name: 'Get Processing Models', value: 'getProcessing', action: 'Get available processing pipelines' },
1220
+ { name: 'Get VLM Models', value: 'getVlm', action: 'Get available VLM models' },
1221
+ ],
1222
+ default: 'getMany',
1223
+ },
1224
+ {
1225
+ displayName: 'Model Name or ID',
1226
+ name: 'modelId',
1227
+ type: 'options',
1228
+ typeOptions: { loadOptionsMethod: 'getModels' },
1229
+ required: true,
1230
+ default: '',
1231
+ displayOptions: { show: { resource: ['model'], operation: ['get'] } },
1232
+ description: 'The model. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
1233
+ },
1234
+ // ==================================================================
1235
+ // SEARCH
1236
+ // ==================================================================
1237
+ {
1238
+ displayName: 'Operation',
1239
+ name: 'operation',
1240
+ type: 'options',
1241
+ noDataExpression: true,
1242
+ displayOptions: { show: { resource: ['search'] } },
1243
+ options: [
1244
+ { name: 'Hybrid Search', value: 'hybridSearch', action: 'Perform hybrid search across datarooms' },
1245
+ ],
1246
+ default: 'hybridSearch',
1247
+ },
1248
+ {
1249
+ displayName: 'Query',
1250
+ name: 'searchQuery',
1251
+ type: 'string',
1252
+ required: true,
1253
+ default: '',
1254
+ displayOptions: { show: { resource: ['search'], operation: ['hybridSearch'] } },
1255
+ description: 'The search query text',
1256
+ },
1257
+ {
1258
+ displayName: 'Dataroom IDs',
1259
+ name: 'dataroomIds',
1260
+ type: 'string',
1261
+ default: '',
1262
+ displayOptions: { show: { resource: ['search'], operation: ['hybridSearch'] } },
1263
+ description: 'Comma-separated list of dataroom IDs to search across',
1264
+ },
1265
+ {
1266
+ displayName: 'Additional Fields',
1267
+ name: 'additionalFields',
1268
+ type: 'collection',
1269
+ placeholder: 'Add Field',
1270
+ default: {},
1271
+ displayOptions: { show: { resource: ['search'], operation: ['hybridSearch'] } },
1272
+ options: [
1273
+ {
1274
+ displayName: 'Top K',
1275
+ name: 'topK',
1276
+ type: 'number',
1277
+ default: 10,
1278
+ description: 'Maximum number of results to return',
1279
+ },
1280
+ {
1281
+ displayName: 'Vector Threshold',
1282
+ name: 'vectorThreshold',
1283
+ type: 'number',
1284
+ default: 0.3,
1285
+ description: 'Vector similarity threshold (0-1)',
1286
+ },
1287
+ {
1288
+ displayName: 'Enable Reranking',
1289
+ name: 'enableReranking',
1290
+ type: 'boolean',
1291
+ default: false,
1292
+ },
1293
+ {
1294
+ displayName: 'Enable Full Text Search',
1295
+ name: 'enableFullTextSearch',
1296
+ type: 'boolean',
1297
+ default: true,
1298
+ },
1299
+ {
1300
+ displayName: 'Max Tokens',
1301
+ name: 'maxTokens',
1302
+ type: 'number',
1303
+ default: 0,
1304
+ description: 'Maximum number of tokens in result set (0 = no limit)',
1305
+ },
1306
+ ],
1307
+ },
1308
+ // ==================================================================
1309
+ // IDENTITY
1310
+ // ==================================================================
1311
+ {
1312
+ displayName: 'Operation',
1313
+ name: 'operation',
1314
+ type: 'options',
1315
+ noDataExpression: true,
1316
+ displayOptions: { show: { resource: ['identity'] } },
1317
+ options: [
1318
+ { name: 'Search', value: 'search', action: 'Search users and groups' },
1319
+ ],
1320
+ default: 'search',
1321
+ },
1322
+ {
1323
+ displayName: 'Search String',
1324
+ name: 'searchString',
1325
+ type: 'string',
1326
+ default: '',
1327
+ displayOptions: { show: { resource: ['identity'], operation: ['search'] } },
1328
+ description: 'Search term to find users and groups',
1329
+ },
1330
+ {
1331
+ displayName: 'Additional Fields',
1332
+ name: 'additionalFields',
1333
+ type: 'collection',
1334
+ placeholder: 'Add Field',
1335
+ default: {},
1336
+ displayOptions: { show: { resource: ['identity'], operation: ['search'] } },
1337
+ options: [
1338
+ {
1339
+ displayName: 'First',
1340
+ name: 'first',
1341
+ type: 'number',
1342
+ default: 0,
1343
+ description: 'Offset for pagination',
1344
+ },
1345
+ {
1346
+ displayName: 'Max',
1347
+ name: 'max',
1348
+ type: 'number',
1349
+ default: 20,
1350
+ description: 'Maximum results to return',
1351
+ },
1352
+ ],
1353
+ },
1354
+ ],
1355
+ };
1356
+ methods = {
1357
+ loadOptions: {
1358
+ getDatarooms: GenericFunctions_1.loadDatarooms,
801
1359
  getDataroomsOptional: GenericFunctions_1.loadDataroomsOptional,
802
1360
  getModels: GenericFunctions_1.loadModels,
803
1361
  getChats: GenericFunctions_1.loadChats,
@@ -813,34 +1371,95 @@ class Aiteza {
813
1371
  const returnData = [];
814
1372
  const resource = this.getNodeParameter('resource', 0);
815
1373
  const operation = this.getNodeParameter('operation', 0);
1374
+ const authMode = this.getNodeParameter('authentication', 0, 'credentials');
1375
+ let authCtx;
1376
+ if (authMode === 'trigger') {
1377
+ const triggerToken = (0, GenericFunctions_1.getUpstreamAuthToken)(this);
1378
+ if (!triggerToken) {
1379
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Authentication is set to "From AITEZA Trigger" but no auth token was found in the input data. ' +
1380
+ 'Make sure this node is connected to an AITEZA Trigger node.');
1381
+ }
1382
+ const baseUrl = this.getNodeParameter('baseUrl', 0).replace(/\/+$/, '');
1383
+ if (!baseUrl) {
1384
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'AITEZA Base URL is required when using trigger authentication.');
1385
+ }
1386
+ authCtx = { baseUrl, triggerToken };
1387
+ }
1388
+ const apiReq = (method, endpoint, body, qs, extraOpts) => GenericFunctions_1.aitezaApiRequest.call(this, method, endpoint, body ?? {}, qs ?? {}, extraOpts ?? {}, authCtx);
1389
+ const getBaseUrl = async () => {
1390
+ if (authCtx?.baseUrl)
1391
+ return authCtx.baseUrl;
1392
+ const credentials = await this.getCredentials('aitezaOAuth2Api');
1393
+ return credentials.baseUrl.replace(/\/+$/, '');
1394
+ };
1395
+ const uploadRequest = async (reqOpts) => {
1396
+ if (authCtx?.triggerToken) {
1397
+ reqOpts.headers = { ...(reqOpts.headers ?? {}), Authorization: `Bearer ${authCtx.triggerToken}` };
1398
+ }
1399
+ // If body is FormData, merge its headers (boundary etc.)
1400
+ if (reqOpts.body instanceof form_data_1.default) {
1401
+ reqOpts.headers = { ...(reqOpts.headers ?? {}), ...reqOpts.body.getHeaders() };
1402
+ }
1403
+ if (authCtx?.triggerToken) {
1404
+ return this.helpers.httpRequest(reqOpts);
1405
+ }
1406
+ return this.helpers.httpRequestWithAuthentication.call(this, 'aitezaOAuth2Api', reqOpts);
1407
+ };
1408
+ const buildPaginationQs = (idx, extraKeys = []) => {
1409
+ const fields = this.getNodeParameter('additionalFields', idx, {});
1410
+ const qs = {};
1411
+ for (const key of ['page', 'size', 'search_term', 'q', 'sortBy', 'sortOrder', 'query', 'name', 'first', 'max', ...extraKeys]) {
1412
+ if (fields[key] !== undefined && fields[key] !== '')
1413
+ qs[key] = fields[key];
1414
+ }
1415
+ return qs;
1416
+ };
1417
+ const doUpload = async (idx, url, fieldName, defaultFileName) => {
1418
+ const binaryPropertyName = this.getNodeParameter('binaryPropertyName', idx);
1419
+ const binaryData = this.helpers.assertBinaryData(idx, binaryPropertyName);
1420
+ const buffer = await this.helpers.getBinaryDataBuffer(idx, binaryPropertyName);
1421
+ const form = new form_data_1.default();
1422
+ form.append(fieldName, buffer, {
1423
+ filename: binaryData.fileName ?? defaultFileName,
1424
+ contentType: binaryData.mimeType,
1425
+ });
1426
+ return uploadRequest({
1427
+ method: 'POST',
1428
+ url,
1429
+ body: form,
1430
+ });
1431
+ };
1432
+ const buildFileUploadUrl = async (idx, basePath) => {
1433
+ const baseUrl = await getBaseUrl();
1434
+ const pipeline = this.getNodeParameter('processingPipeline', idx);
1435
+ const vlmModel = this.getNodeParameter('vlmModel', idx, '');
1436
+ let url = `${baseUrl}${basePath}?processingPipeline=${encodeURIComponent(pipeline)}`;
1437
+ if (vlmModel)
1438
+ url += `&vlmModel=${encodeURIComponent(vlmModel)}`;
1439
+ return url;
1440
+ };
1441
+ const splitCsv = (val) => val.split(',').map((s) => s.trim()).filter(Boolean);
816
1442
  for (let i = 0; i < items.length; i++) {
817
1443
  try {
818
1444
  let responseData;
819
- // =============================================================
820
- // DATAROOM
821
- // =============================================================
1445
+ // ── DATAROOM ──────────────────────────────────────────────
822
1446
  if (resource === 'dataroom') {
823
1447
  if (operation === 'get') {
824
1448
  const id = this.getNodeParameter('dataroomId', i);
825
1449
  (0, GenericFunctions_1.validateRequiredField)(this, id, 'Dataroom ID');
826
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/dataroom/${id}`);
1450
+ responseData = await apiReq('GET', `/api/dataroom/${id}`);
827
1451
  }
828
- if (operation === 'getChildren') {
1452
+ else if (operation === 'getChildren') {
829
1453
  const id = this.getNodeParameter('dataroomId', i);
830
1454
  const nameFilter = this.getNodeParameter('nameFilter', i, '');
831
- const additionalFields = this.getNodeParameter('additionalFields', i, {});
832
- const qs = { name: nameFilter };
833
- if (additionalFields.sortBy)
834
- qs.sortBy = additionalFields.sortBy;
835
- if (additionalFields.sortOrder)
836
- qs.sortOrder = additionalFields.sortOrder;
837
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/dataroom/${id}/children`, {}, qs);
1455
+ const qs = { q: nameFilter, ...buildPaginationQs(i) };
1456
+ responseData = await apiReq('GET', `/api/dataroom/${id}/children`, {}, qs);
838
1457
  }
839
- if (operation === 'search') {
1458
+ else if (operation === 'search') {
840
1459
  const name = this.getNodeParameter('name', i);
841
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', '/api/dataroom/search', {}, { name });
1460
+ responseData = await apiReq('GET', '/api/dataroom/search', {}, { q: name });
842
1461
  }
843
- if (operation === 'create') {
1462
+ else if (operation === 'create') {
844
1463
  const name = this.getNodeParameter('name', i);
845
1464
  const access = this.getNodeParameter('access', i);
846
1465
  const parentId = this.getNodeParameter('parentId', i, '');
@@ -848,386 +1467,497 @@ class Aiteza {
848
1467
  const body = { name, access };
849
1468
  if (parentId)
850
1469
  body.parent = parentId;
851
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'POST', '/api/dataroom', body);
1470
+ responseData = await apiReq('POST', '/api/dataroom', body);
852
1471
  }
853
- if (operation === 'update') {
1472
+ else if (operation === 'update') {
854
1473
  const id = this.getNodeParameter('dataroomId', i);
855
- const updateFields = this.getNodeParameter('updateFields', i, {});
856
1474
  (0, GenericFunctions_1.validateRequiredField)(this, id, 'Dataroom ID');
857
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'PATCH', `/api/dataroom/${id}`, updateFields);
1475
+ const updateFields = this.getNodeParameter('updateFields', i, {});
1476
+ responseData = await apiReq('PATCH', `/api/dataroom/${id}`, updateFields);
858
1477
  }
859
- if (operation === 'delete') {
1478
+ else if (operation === 'delete') {
860
1479
  const idsRaw = this.getNodeParameter('dataroomIds', i);
861
- const dataroomIds = idsRaw.split(',').map((s) => s.trim()).filter(Boolean);
1480
+ const dataroomIds = splitCsv(idsRaw);
862
1481
  (0, GenericFunctions_1.validateRequiredField)(this, dataroomIds.length > 0 ? 'ok' : '', 'Dataroom IDs');
863
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'DELETE', '/api/dataroom/delete', { dataroomIds });
1482
+ responseData = await apiReq('DELETE', '/api/dataroom/delete', { dataroomIds });
1483
+ }
1484
+ else if (operation === 'star') {
1485
+ const id = this.getNodeParameter('dataroomId', i);
1486
+ responseData = await apiReq('PATCH', `/api/dataroom/${id}/star`);
1487
+ }
1488
+ else if (operation === 'unstar') {
1489
+ const id = this.getNodeParameter('dataroomId', i);
1490
+ responseData = await apiReq('PATCH', `/api/dataroom/${id}/unstar`);
1491
+ }
1492
+ else if (operation === 'getStarred') {
1493
+ responseData = await apiReq('GET', '/api/dataroom/starred', {}, buildPaginationQs(i));
1494
+ }
1495
+ else if (operation === 'getRecent') {
1496
+ responseData = await apiReq('GET', '/api/dataroom/recent');
1497
+ }
1498
+ else if (operation === 'getConnected') {
1499
+ const id = this.getNodeParameter('dataroomId', i);
1500
+ responseData = await apiReq('GET', `/api/dataroom/${id}/connected`);
1501
+ }
1502
+ else if (operation === 'setConnected') {
1503
+ const id = this.getNodeParameter('dataroomId', i);
1504
+ const idsRaw = this.getNodeParameter('connectedDataroomIds', i);
1505
+ const connectedDataroomIds = splitCsv(idsRaw);
1506
+ responseData = await apiReq('PUT', `/api/dataroom/${id}/connected`, { connectedDataroomIds });
1507
+ }
1508
+ else if (operation === 'getChats') {
1509
+ const id = this.getNodeParameter('dataroomId', i);
1510
+ responseData = await apiReq('GET', `/api/dataroom/${id}/chats`, {}, buildPaginationQs(i));
1511
+ }
1512
+ else if (operation === 'getModels') {
1513
+ const id = this.getNodeParameter('dataroomId', i);
1514
+ responseData = await apiReq('GET', `/api/dataroom/${id}/models`);
864
1515
  }
865
1516
  }
866
- // =============================================================
867
- // FILE
868
- // =============================================================
869
- if (resource === 'file') {
1517
+ // ── DATAROOM MEMBER ──────────────────────────────────────
1518
+ else if (resource === 'dataroomMember') {
1519
+ const dataroomId = this.getNodeParameter('dataroomId', i);
870
1520
  if (operation === 'getMany') {
871
- const dataroomId = this.getNodeParameter('dataroomId', i);
872
- const additionalFields = this.getNodeParameter('additionalFields', i, {});
1521
+ const search = this.getNodeParameter('searchTerm', i, '');
873
1522
  const qs = {};
874
- if (additionalFields.page !== undefined)
875
- qs.page = additionalFields.page;
876
- if (additionalFields.size !== undefined)
877
- qs.size = additionalFields.size;
878
- if (additionalFields.search_term)
879
- qs.search_term = additionalFields.search_term;
880
- if (additionalFields.sortBy)
881
- qs.sortBy = additionalFields.sortBy;
882
- if (additionalFields.sortOrder)
883
- qs.sortOrder = additionalFields.sortOrder;
884
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/dataroom/${dataroomId}/files`, {}, qs);
885
- }
886
- if (operation === 'getManyStandalone') {
887
- const additionalFields = this.getNodeParameter('additionalFields', i, {});
1523
+ if (search)
1524
+ qs.q = search;
1525
+ responseData = await apiReq('GET', `/api/dataroom/${dataroomId}/members`, {}, qs);
1526
+ }
1527
+ else if (operation === 'add') {
1528
+ const usernames = splitCsv(this.getNodeParameter('usernames', i));
1529
+ const role = this.getNodeParameter('role', i);
1530
+ const inherit = this.getNodeParameter('inherit', i, false);
1531
+ responseData = await apiReq('POST', `/api/dataroom/${dataroomId}/members`, { user: usernames, role, inherit });
1532
+ }
1533
+ else if (operation === 'remove') {
1534
+ const usernames = splitCsv(this.getNodeParameter('usernames', i));
1535
+ const inherit = this.getNodeParameter('inherit', i, false);
1536
+ responseData = await apiReq('DELETE', `/api/dataroom/${dataroomId}/members`, { user: usernames, inherit });
1537
+ }
1538
+ else if (operation === 'updateRole') {
1539
+ const usernames = splitCsv(this.getNodeParameter('usernames', i));
1540
+ const role = this.getNodeParameter('role', i);
1541
+ const inherit = this.getNodeParameter('inherit', i, false);
1542
+ responseData = await apiReq('PATCH', `/api/dataroom/${dataroomId}/members`, { user: usernames, role, inherit });
1543
+ }
1544
+ }
1545
+ // ── DATAROOM GROUP ───────────────────────────────────────
1546
+ else if (resource === 'dataroomGroup') {
1547
+ const dataroomId = this.getNodeParameter('dataroomId', i);
1548
+ if (operation === 'getMany') {
1549
+ const search = this.getNodeParameter('searchTerm', i, '');
888
1550
  const qs = {};
889
- if (additionalFields.page !== undefined)
890
- qs.page = additionalFields.page;
891
- if (additionalFields.size !== undefined)
892
- qs.size = additionalFields.size;
893
- if (additionalFields.search_term)
894
- qs.search_term = additionalFields.search_term;
895
- if (additionalFields.sortBy)
896
- qs.sortBy = additionalFields.sortBy;
897
- if (additionalFields.sortOrder)
898
- qs.sortOrder = additionalFields.sortOrder;
899
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', '/api/files', {}, qs);
1551
+ if (search)
1552
+ qs.q = search;
1553
+ responseData = await apiReq('GET', `/api/dataroom/${dataroomId}/groups`, {}, qs);
900
1554
  }
901
- if (operation === 'get') {
1555
+ else if (operation === 'add') {
1556
+ const groupPath = this.getNodeParameter('groupPath', i);
1557
+ const role = this.getNodeParameter('role', i);
1558
+ const inherit = this.getNodeParameter('inherit', i, false);
1559
+ responseData = await apiReq('POST', `/api/dataroom/${dataroomId}/groups`, { group: groupPath, role, inherit });
1560
+ }
1561
+ else if (operation === 'remove') {
1562
+ const groupPath = this.getNodeParameter('groupPath', i);
1563
+ const inherit = this.getNodeParameter('inherit', i, false);
1564
+ responseData = await apiReq('DELETE', `/api/dataroom/${dataroomId}/groups`, { group: groupPath, inherit });
1565
+ }
1566
+ else if (operation === 'updateRole') {
1567
+ const groupPath = this.getNodeParameter('groupPath', i);
1568
+ const role = this.getNodeParameter('role', i);
1569
+ const inherit = this.getNodeParameter('inherit', i, false);
1570
+ responseData = await apiReq('PATCH', `/api/dataroom/${dataroomId}/groups`, { group: groupPath, role, inherit });
1571
+ }
1572
+ }
1573
+ // ── FILE ─────────────────────────────────────────────────
1574
+ else if (resource === 'file') {
1575
+ if (operation === 'getMany') {
1576
+ const dataroomId = this.getNodeParameter('dataroomId', i);
1577
+ const qs = buildPaginationQs(i);
1578
+ // API uses 'q' for dataroom-scoped files; map search_term → q
1579
+ if (qs.search_term) {
1580
+ qs.q = qs.search_term;
1581
+ delete qs.search_term;
1582
+ }
1583
+ responseData = await apiReq('GET', `/api/dataroom/${dataroomId}/files`, {}, qs);
1584
+ }
1585
+ else if (operation === 'getManyStandalone') {
1586
+ responseData = await apiReq('GET', '/api/files', {}, buildPaginationQs(i));
1587
+ }
1588
+ else if (operation === 'get') {
902
1589
  const dataroomId = this.getNodeParameter('dataroomId', i);
903
1590
  const fileId = this.getNodeParameter('fileId', i);
904
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/dataroom/${dataroomId}/files/${fileId}`);
1591
+ responseData = await apiReq('GET', `/api/dataroom/${dataroomId}/files/${fileId}`);
905
1592
  }
906
- if (operation === 'getMetadata') {
1593
+ else if (operation === 'getMetadata') {
907
1594
  const fileId = this.getNodeParameter('fileId', i);
908
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/files/${fileId}`);
1595
+ responseData = await apiReq('GET', `/api/files/${fileId}`);
909
1596
  }
910
- if (operation === 'getContent') {
1597
+ else if (operation === 'getContent') {
911
1598
  const fileId = this.getNodeParameter('fileId', i);
912
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/files/${fileId}/content`, {}, {}, { json: false });
1599
+ responseData = await apiReq('GET', `/api/files/${fileId}/content`, {}, {}, { json: false });
913
1600
  if (typeof responseData === 'string') {
914
1601
  responseData = { content: responseData };
915
1602
  }
916
1603
  }
917
- if (operation === 'getStatus') {
1604
+ else if (operation === 'getStatus') {
1605
+ const fileId = this.getNodeParameter('fileId', i);
1606
+ responseData = await apiReq('GET', `/api/files/${fileId}/status`);
1607
+ }
1608
+ else if (operation === 'getOriginalUrl') {
918
1609
  const fileId = this.getNodeParameter('fileId', i);
919
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/files/${fileId}/status`);
1610
+ responseData = await apiReq('GET', `/api/files/${fileId}/original`);
1611
+ if (typeof responseData === 'string') {
1612
+ responseData = { url: responseData };
1613
+ }
920
1614
  }
921
- if (operation === 'delete') {
1615
+ else if (operation === 'getOriginalUrlDataroom') {
922
1616
  const dataroomId = this.getNodeParameter('dataroomId', i);
923
1617
  const fileId = this.getNodeParameter('fileId', i);
924
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'DELETE', `/api/dataroom/${dataroomId}/files/${fileId}`);
1618
+ responseData = await apiReq('GET', `/api/dataroom/${dataroomId}/files/${fileId}/original`);
1619
+ if (typeof responseData === 'string') {
1620
+ responseData = { url: responseData };
1621
+ }
925
1622
  }
926
- if (operation === 'deleteStandalone') {
1623
+ else if (operation === 'getChunks') {
927
1624
  const fileId = this.getNodeParameter('fileId', i);
928
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'DELETE', `/api/files/${fileId}`);
1625
+ responseData = await apiReq('GET', `/api/files/${fileId}/chunks`, {}, buildPaginationQs(i));
929
1626
  }
930
- if (operation === 'assign') {
1627
+ else if (operation === 'getChunksDataroom') {
1628
+ const dataroomId = this.getNodeParameter('dataroomId', i);
1629
+ const fileId = this.getNodeParameter('fileId', i);
1630
+ responseData = await apiReq('GET', `/api/dataroom/${dataroomId}/files/${fileId}/chunks`, {}, buildPaginationQs(i));
1631
+ }
1632
+ else if (operation === 'delete') {
1633
+ const dataroomId = this.getNodeParameter('dataroomId', i);
1634
+ const fileId = this.getNodeParameter('fileId', i);
1635
+ responseData = await apiReq('DELETE', `/api/dataroom/${dataroomId}/files/${fileId}`);
1636
+ }
1637
+ else if (operation === 'deleteStandalone') {
1638
+ const fileId = this.getNodeParameter('fileId', i);
1639
+ responseData = await apiReq('DELETE', `/api/files/${fileId}`);
1640
+ }
1641
+ else if (operation === 'deleteAllDataroom') {
1642
+ const dataroomId = this.getNodeParameter('dataroomId', i);
1643
+ responseData = await apiReq('DELETE', `/api/dataroom/${dataroomId}/files`);
1644
+ }
1645
+ else if (operation === 'assign') {
931
1646
  const fileId = this.getNodeParameter('fileId', i);
932
1647
  const targetDataroomId = this.getNodeParameter('targetDataroomId', i);
933
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'PATCH', `/api/files/${fileId}/assign`, { dataroomId: targetDataroomId });
1648
+ responseData = await apiReq('PATCH', `/api/files/${fileId}/assign`, { dataroomId: targetDataroomId });
934
1649
  }
935
- if (operation === 'upload') {
1650
+ else if (operation === 'move') {
936
1651
  const dataroomId = this.getNodeParameter('dataroomId', i);
937
- const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
938
- const processingPipeline = this.getNodeParameter('processingPipeline', i);
939
- const vlmModel = this.getNodeParameter('vlmModel', i, '');
940
- const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
941
- const credentials = await this.getCredentials('aitezaOAuth2Api');
942
- const baseUrl = credentials.baseUrl.replace(/\/+$/, '');
943
- const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
944
- let url = `${baseUrl}/api/dataroom/${dataroomId}/files?processingPipeline=${encodeURIComponent(processingPipeline)}`;
945
- if (vlmModel)
946
- url += `&vlmModel=${encodeURIComponent(vlmModel)}`;
947
- responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'aitezaOAuth2Api', {
948
- method: 'POST',
949
- url,
950
- formData: {
951
- files: {
952
- value: buffer,
953
- options: {
954
- filename: binaryData.fileName ?? 'file',
955
- contentType: binaryData.mimeType,
956
- },
957
- },
958
- },
959
- });
1652
+ const fileId = this.getNodeParameter('fileId', i);
1653
+ const targetDataroomId = this.getNodeParameter('targetDataroomId', i);
1654
+ responseData = await apiReq('PATCH', `/api/dataroom/${dataroomId}/files/${fileId}/move`, {}, { targetDataroom: targetDataroomId });
960
1655
  }
961
- if (operation === 'uploadStandalone') {
962
- const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
963
- const processingPipeline = this.getNodeParameter('processingPipeline', i);
1656
+ else if (operation === 'reprocess') {
1657
+ const dataroomId = this.getNodeParameter('dataroomId', i);
1658
+ const fileId = this.getNodeParameter('fileId', i);
1659
+ const pipeline = this.getNodeParameter('processingPipeline', i);
964
1660
  const vlmModel = this.getNodeParameter('vlmModel', i, '');
965
- const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
966
- const credentials = await this.getCredentials('aitezaOAuth2Api');
967
- const baseUrl = credentials.baseUrl.replace(/\/+$/, '');
968
- const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
969
- let url = `${baseUrl}/api/files?processingPipeline=${encodeURIComponent(processingPipeline)}`;
1661
+ const qs = { processingPipeline: pipeline };
970
1662
  if (vlmModel)
971
- url += `&vlmModel=${encodeURIComponent(vlmModel)}`;
972
- responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'aitezaOAuth2Api', {
973
- method: 'POST',
974
- url,
975
- formData: {
976
- files: {
977
- value: buffer,
978
- options: {
979
- filename: binaryData.fileName ?? 'file',
980
- contentType: binaryData.mimeType,
981
- },
982
- },
983
- },
984
- });
1663
+ qs.vlmModel = vlmModel;
1664
+ responseData = await apiReq('POST', `/api/dataroom/${dataroomId}/files/${fileId}/reprocess`, {}, qs);
1665
+ }
1666
+ else if (operation === 'upload') {
1667
+ const dataroomId = this.getNodeParameter('dataroomId', i);
1668
+ const url = await buildFileUploadUrl(i, `/api/dataroom/${dataroomId}/files`);
1669
+ responseData = await doUpload(i, url, 'files', 'file');
1670
+ }
1671
+ else if (operation === 'uploadStandalone') {
1672
+ const url = await buildFileUploadUrl(i, '/api/files');
1673
+ responseData = await doUpload(i, url, 'files', 'file');
985
1674
  }
986
1675
  }
987
- // =============================================================
988
- // IMAGE
989
- // =============================================================
990
- if (resource === 'image') {
1676
+ // ── IMAGE ────────────────────────────────────────────────
1677
+ else if (resource === 'image') {
991
1678
  if (operation === 'getManyDataroom') {
992
1679
  const dataroomId = this.getNodeParameter('dataroomId', i);
993
- const additionalFields = this.getNodeParameter('additionalFields', i, {});
994
- const qs = {};
995
- if (additionalFields.page !== undefined)
996
- qs.page = additionalFields.page;
997
- if (additionalFields.size !== undefined)
998
- qs.size = additionalFields.size;
999
- if (additionalFields.search_term)
1000
- qs.search_term = additionalFields.search_term;
1001
- if (additionalFields.sortBy)
1002
- qs.sortBy = additionalFields.sortBy;
1003
- if (additionalFields.sortOrder)
1004
- qs.sortOrder = additionalFields.sortOrder;
1005
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/dataroom/${dataroomId}/images`, {}, qs);
1006
- }
1007
- if (operation === 'getManyStandalone') {
1008
- const additionalFields = this.getNodeParameter('additionalFields', i, {});
1009
- const qs = {};
1010
- if (additionalFields.page !== undefined)
1011
- qs.page = additionalFields.page;
1012
- if (additionalFields.size !== undefined)
1013
- qs.size = additionalFields.size;
1014
- if (additionalFields.search_term)
1015
- qs.search_term = additionalFields.search_term;
1016
- if (additionalFields.sortBy)
1017
- qs.sortBy = additionalFields.sortBy;
1018
- if (additionalFields.sortOrder)
1019
- qs.sortOrder = additionalFields.sortOrder;
1020
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', '/api/images', {}, qs);
1021
- }
1022
- if (operation === 'getDataroom') {
1680
+ const qs = buildPaginationQs(i);
1681
+ // API uses 'q' for dataroom-scoped images; map search_term → q
1682
+ if (qs.search_term) {
1683
+ qs.q = qs.search_term;
1684
+ delete qs.search_term;
1685
+ }
1686
+ responseData = await apiReq('GET', `/api/dataroom/${dataroomId}/images`, {}, qs);
1687
+ }
1688
+ else if (operation === 'getManyStandalone') {
1689
+ responseData = await apiReq('GET', '/api/images', {}, buildPaginationQs(i));
1690
+ }
1691
+ else if (operation === 'getDataroom') {
1023
1692
  const dataroomId = this.getNodeParameter('dataroomId', i);
1024
1693
  const imageId = this.getNodeParameter('imageId', i);
1025
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/dataroom/${dataroomId}/images/${imageId}`);
1694
+ responseData = await apiReq('GET', `/api/dataroom/${dataroomId}/images/${imageId}`);
1695
+ }
1696
+ else if (operation === 'getMetadata') {
1697
+ const imageId = this.getNodeParameter('imageId', i);
1698
+ responseData = await apiReq('GET', `/api/images/${imageId}`);
1026
1699
  }
1027
- if (operation === 'getMetadata') {
1700
+ else if (operation === 'getStatus') {
1028
1701
  const imageId = this.getNodeParameter('imageId', i);
1029
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/images/${imageId}`);
1702
+ responseData = await apiReq('GET', `/api/images/${imageId}/status`);
1030
1703
  }
1031
- if (operation === 'getStatus') {
1704
+ else if (operation === 'getOriginalUrl') {
1032
1705
  const imageId = this.getNodeParameter('imageId', i);
1033
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/images/${imageId}/status`);
1706
+ responseData = await apiReq('GET', `/api/images/${imageId}/original`);
1707
+ if (typeof responseData === 'string') {
1708
+ responseData = { url: responseData };
1709
+ }
1710
+ }
1711
+ else if (operation === 'getOriginalUrlDataroom') {
1712
+ const dataroomId = this.getNodeParameter('dataroomId', i);
1713
+ const imageId = this.getNodeParameter('imageId', i);
1714
+ responseData = await apiReq('GET', `/api/dataroom/${dataroomId}/images/${imageId}/original`);
1715
+ if (typeof responseData === 'string') {
1716
+ responseData = { url: responseData };
1717
+ }
1034
1718
  }
1035
- if (operation === 'deleteDataroom') {
1719
+ else if (operation === 'deleteDataroom') {
1036
1720
  const dataroomId = this.getNodeParameter('dataroomId', i);
1037
1721
  const imageId = this.getNodeParameter('imageId', i);
1038
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'DELETE', `/api/dataroom/${dataroomId}/images/${imageId}`);
1722
+ responseData = await apiReq('DELETE', `/api/dataroom/${dataroomId}/images/${imageId}`);
1039
1723
  }
1040
- if (operation === 'deleteStandalone') {
1724
+ else if (operation === 'deleteStandalone') {
1041
1725
  const imageId = this.getNodeParameter('imageId', i);
1042
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'DELETE', `/api/images/${imageId}`);
1726
+ responseData = await apiReq('DELETE', `/api/images/${imageId}`);
1043
1727
  }
1044
- if (operation === 'assign') {
1728
+ else if (operation === 'deleteAllDataroom') {
1729
+ const dataroomId = this.getNodeParameter('dataroomId', i);
1730
+ responseData = await apiReq('DELETE', `/api/dataroom/${dataroomId}/images`);
1731
+ }
1732
+ else if (operation === 'assign') {
1045
1733
  const imageId = this.getNodeParameter('imageId', i);
1046
1734
  const targetDataroomId = this.getNodeParameter('targetDataroomId', i);
1047
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'PATCH', `/api/images/${imageId}/assign`, { dataroomId: targetDataroomId });
1735
+ responseData = await apiReq('PATCH', `/api/images/${imageId}/assign`, { dataroomId: targetDataroomId });
1048
1736
  }
1049
- if (operation === 'uploadDataroom') {
1737
+ else if (operation === 'move') {
1050
1738
  const dataroomId = this.getNodeParameter('dataroomId', i);
1051
- const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
1052
- const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
1053
- const credentials = await this.getCredentials('aitezaOAuth2Api');
1054
- const baseUrl = credentials.baseUrl.replace(/\/+$/, '');
1055
- const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
1056
- responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'aitezaOAuth2Api', {
1057
- method: 'POST',
1058
- url: `${baseUrl}/api/dataroom/${dataroomId}/images`,
1059
- formData: {
1060
- images: {
1061
- value: buffer,
1062
- options: {
1063
- filename: binaryData.fileName ?? 'image',
1064
- contentType: binaryData.mimeType,
1065
- },
1066
- },
1067
- },
1068
- });
1739
+ const imageId = this.getNodeParameter('imageId', i);
1740
+ const targetDataroomId = this.getNodeParameter('targetDataroomId', i);
1741
+ responseData = await apiReq('PATCH', `/api/dataroom/${dataroomId}/images/${imageId}/move`, {}, { targetDataroom: targetDataroomId });
1069
1742
  }
1070
- if (operation === 'uploadStandalone') {
1071
- const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
1072
- const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
1073
- const credentials = await this.getCredentials('aitezaOAuth2Api');
1074
- const baseUrl = credentials.baseUrl.replace(/\/+$/, '');
1075
- const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
1076
- responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'aitezaOAuth2Api', {
1077
- method: 'POST',
1078
- url: `${baseUrl}/api/images`,
1079
- formData: {
1080
- images: {
1081
- value: buffer,
1082
- options: {
1083
- filename: binaryData.fileName ?? 'image',
1084
- contentType: binaryData.mimeType,
1085
- },
1086
- },
1087
- },
1088
- });
1743
+ else if (operation === 'uploadDataroom') {
1744
+ const dataroomId = this.getNodeParameter('dataroomId', i);
1745
+ const baseUrl = await getBaseUrl();
1746
+ responseData = await doUpload(i, `${baseUrl}/api/dataroom/${dataroomId}/images`, 'images', 'image');
1747
+ }
1748
+ else if (operation === 'uploadStandalone') {
1749
+ const baseUrl = await getBaseUrl();
1750
+ responseData = await doUpload(i, `${baseUrl}/api/images`, 'images', 'image');
1089
1751
  }
1090
1752
  }
1091
- // =============================================================
1092
- // WEB SOURCE
1093
- // =============================================================
1094
- if (resource === 'webSource') {
1753
+ // ── WEB SOURCE ───────────────────────────────────────────
1754
+ else if (resource === 'webSource') {
1095
1755
  const dataroomId = this.getNodeParameter('dataroomId', i);
1096
1756
  if (operation === 'getMany') {
1097
- const additionalFields = this.getNodeParameter('additionalFields', i, {});
1098
- const qs = {};
1099
- if (additionalFields.page !== undefined)
1100
- qs.page = additionalFields.page;
1101
- if (additionalFields.size !== undefined)
1102
- qs.size = additionalFields.size;
1103
- if (additionalFields.search_term)
1104
- qs.search_term = additionalFields.search_term;
1105
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/dataroom/${dataroomId}/websites`, {}, qs);
1757
+ responseData = await apiReq('GET', `/api/dataroom/${dataroomId}/websites`, {}, buildPaginationQs(i));
1106
1758
  }
1107
- if (operation === 'get') {
1759
+ else if (operation === 'get') {
1108
1760
  const webSourceId = this.getNodeParameter('webSourceId', i);
1109
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/dataroom/${dataroomId}/websites/${webSourceId}`);
1761
+ responseData = await apiReq('GET', `/api/dataroom/${dataroomId}/websites/${webSourceId}`);
1110
1762
  }
1111
- if (operation === 'add') {
1763
+ else if (operation === 'add') {
1112
1764
  const url = this.getNodeParameter('url', i);
1113
1765
  const additionalFields = this.getNodeParameter('additionalFields', i, {});
1114
- const body = { url };
1115
- if (additionalFields.name)
1116
- body.name = additionalFields.name;
1117
- if (additionalFields.includeSubpages !== undefined)
1118
- body.includeSubpages = additionalFields.includeSubpages;
1119
- if (additionalFields.maxSubpages !== undefined)
1120
- body.maxSubpages = additionalFields.maxSubpages;
1121
- if (additionalFields.maxDepth !== undefined)
1122
- body.maxDepth = additionalFields.maxDepth;
1123
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'POST', `/api/dataroom/${dataroomId}/websites`, body);
1124
- }
1125
- if (operation === 'delete') {
1766
+ const body = { url, ...additionalFields };
1767
+ responseData = await apiReq('POST', `/api/dataroom/${dataroomId}/websites`, body);
1768
+ }
1769
+ else if (operation === 'delete') {
1126
1770
  const webSourceId = this.getNodeParameter('webSourceId', i);
1127
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'DELETE', `/api/dataroom/${dataroomId}/websites/${webSourceId}`);
1771
+ responseData = await apiReq('DELETE', `/api/dataroom/${dataroomId}/websites/${webSourceId}`);
1772
+ }
1773
+ else if (operation === 'deleteAll') {
1774
+ responseData = await apiReq('DELETE', `/api/dataroom/${dataroomId}/websites`);
1775
+ }
1776
+ else if (operation === 'rescan') {
1777
+ const webSourceId = this.getNodeParameter('webSourceId', i);
1778
+ const rescanOptions = this.getNodeParameter('rescanOptions', i, {});
1779
+ responseData = await apiReq('PATCH', `/api/dataroom/${dataroomId}/websites/${webSourceId}`, rescanOptions);
1780
+ }
1781
+ else if (operation === 'move') {
1782
+ const webSourceId = this.getNodeParameter('webSourceId', i);
1783
+ const targetDataroomId = this.getNodeParameter('targetDataroomId', i);
1784
+ responseData = await apiReq('PATCH', `/api/dataroom/${dataroomId}/websites/${webSourceId}/move`, {}, { targetDataroom: targetDataroomId });
1128
1785
  }
1129
1786
  }
1130
- // =============================================================
1131
- // CHAT
1132
- // =============================================================
1133
- if (resource === 'chat') {
1787
+ // ── CHAT ─────────────────────────────────────────────────
1788
+ else if (resource === 'chat') {
1134
1789
  if (operation === 'create') {
1135
1790
  const chatName = this.getNodeParameter('chatName', i, '');
1136
- const body = {};
1137
- if (chatName)
1138
- body.name = chatName;
1139
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'POST', '/api/chat', body);
1791
+ responseData = await apiReq('POST', '/api/chat', chatName ? { name: chatName } : {});
1140
1792
  }
1141
- if (operation === 'get') {
1793
+ else if (operation === 'get') {
1142
1794
  const chatId = this.getNodeParameter('chatId', i);
1143
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/chat/${chatId}`);
1795
+ responseData = await apiReq('GET', `/api/chat/${chatId}`);
1144
1796
  }
1145
- if (operation === 'getMany') {
1146
- const additionalFields = this.getNodeParameter('additionalFields', i, {});
1147
- const qs = {};
1148
- if (additionalFields.page !== undefined)
1149
- qs.page = additionalFields.page;
1150
- if (additionalFields.size !== undefined)
1151
- qs.size = additionalFields.size;
1152
- if (additionalFields.query)
1153
- qs.query = additionalFields.query;
1154
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', '/api/chat', {}, qs);
1155
- }
1156
- if (operation === 'getMessages') {
1797
+ else if (operation === 'getMany') {
1798
+ responseData = await apiReq('GET', '/api/chat', {}, buildPaginationQs(i));
1799
+ }
1800
+ else if (operation === 'getMessages') {
1801
+ const chatId = this.getNodeParameter('chatId', i);
1802
+ responseData = await apiReq('GET', `/api/chat/${chatId}/messages`);
1803
+ }
1804
+ else if (operation === 'getMessage') {
1157
1805
  const chatId = this.getNodeParameter('chatId', i);
1158
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/chat/${chatId}/messages`);
1806
+ const messageId = this.getNodeParameter('messageId', i);
1807
+ responseData = await apiReq('GET', `/api/chat/${chatId}/messages/${messageId}`);
1159
1808
  }
1160
- if (operation === 'delete') {
1809
+ else if (operation === 'getLatestMessage') {
1161
1810
  const chatId = this.getNodeParameter('chatId', i);
1162
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'DELETE', `/api/chat/${chatId}`);
1811
+ responseData = await apiReq('GET', `/api/chat/${chatId}/messages/latest`);
1163
1812
  }
1164
- if (operation === 'rename') {
1813
+ else if (operation === 'delete') {
1814
+ const chatId = this.getNodeParameter('chatId', i);
1815
+ responseData = await apiReq('DELETE', `/api/chat/${chatId}`);
1816
+ }
1817
+ else if (operation === 'deleteMessages') {
1818
+ const chatId = this.getNodeParameter('chatId', i);
1819
+ responseData = await apiReq('DELETE', `/api/chat/${chatId}/messages`);
1820
+ }
1821
+ else if (operation === 'rename') {
1165
1822
  const chatId = this.getNodeParameter('chatId', i);
1166
1823
  const newName = this.getNodeParameter('newName', i);
1167
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'PATCH', `/api/chat/${chatId}`, { name: newName });
1824
+ responseData = await apiReq('PATCH', `/api/chat/${chatId}`, { name: newName });
1168
1825
  }
1169
- if (operation === 'generate') {
1826
+ else if (operation === 'generate') {
1170
1827
  const chatId = this.getNodeParameter('chatId', i);
1171
1828
  const prompt = this.getNodeParameter('prompt', i);
1172
1829
  const model = this.getNodeParameter('model', i);
1173
1830
  const additionalFields = this.getNodeParameter('additionalFields', i, {});
1174
- // Build multipart form data matching GenerateChatRequest
1175
- const formData = { prompt, model };
1176
- if (additionalFields.connectedDatarooms) {
1177
- formData.connectedDatarooms = additionalFields.connectedDatarooms
1178
- .split(',').map((s) => s.trim()).filter(Boolean);
1831
+ const form = new form_data_1.default();
1832
+ form.append('prompt', prompt);
1833
+ form.append('model', model);
1834
+ for (const key of ['connectedDatarooms', 'fileIds', 'imageIds']) {
1835
+ if (additionalFields[key]) {
1836
+ for (const val of splitCsv(additionalFields[key])) {
1837
+ form.append(key, val);
1838
+ }
1839
+ }
1179
1840
  }
1180
- if (additionalFields.fileIds) {
1181
- formData.fileIds = additionalFields.fileIds
1182
- .split(',').map((s) => s.trim()).filter(Boolean);
1841
+ for (const key of ['parentDatarooms', 'subDatarooms', 'webSearchEnabled', 'agenticMode', 'workflowId']) {
1842
+ if (additionalFields[key] !== undefined && additionalFields[key] !== '')
1843
+ form.append(key, String(additionalFields[key]));
1183
1844
  }
1184
- if (additionalFields.imageIds) {
1185
- formData.imageIds = additionalFields.imageIds
1186
- .split(',').map((s) => s.trim()).filter(Boolean);
1845
+ const baseUrl = await getBaseUrl();
1846
+ const response = await uploadRequest({
1847
+ method: 'POST',
1848
+ url: `${baseUrl}/api/chat/${chatId}/generate`,
1849
+ body: form,
1850
+ returnFullResponse: true,
1851
+ });
1852
+ responseData = typeof response === 'object' && response.body !== undefined ? response.body : response;
1853
+ const xChatId = response?.headers?.['x-chat-id'];
1854
+ if (xChatId && typeof responseData === 'object' && responseData !== null) {
1855
+ responseData._chatId = xChatId;
1187
1856
  }
1188
- if (additionalFields.parentDatarooms !== undefined)
1189
- formData.parentDatarooms = additionalFields.parentDatarooms;
1190
- if (additionalFields.subDatarooms !== undefined)
1191
- formData.subDatarooms = additionalFields.subDatarooms;
1192
- if (additionalFields.webSearchEnabled !== undefined)
1193
- formData.webSearchEnabled = additionalFields.webSearchEnabled;
1194
- if (additionalFields.agenticMode !== undefined)
1195
- formData.agenticMode = additionalFields.agenticMode;
1196
- const response = await GenericFunctions_1.aitezaApiRequestFullResponse.call(this, 'POST', `/api/chat/${chatId}/generate`, {}, {}, { formData });
1197
- responseData = response.body;
1198
- // Expose X-Chat-Id header if present (when using 'new' as chatId)
1199
- const xChatId = response.headers?.['x-chat-id'];
1200
- if (xChatId) {
1201
- if (typeof responseData === 'object' && responseData !== null) {
1202
- responseData._chatId = xChatId;
1857
+ }
1858
+ else if (operation === 'estimate') {
1859
+ const prompt = this.getNodeParameter('prompt', i);
1860
+ const model = this.getNodeParameter('model', i);
1861
+ const additionalFields = this.getNodeParameter('additionalFields', i, {});
1862
+ const form = new form_data_1.default();
1863
+ form.append('prompt', prompt);
1864
+ form.append('model', model);
1865
+ for (const key of ['connectedDatarooms', 'fileIds', 'imageIds']) {
1866
+ if (additionalFields[key]) {
1867
+ for (const val of splitCsv(additionalFields[key])) {
1868
+ form.append(key, val);
1869
+ }
1203
1870
  }
1204
1871
  }
1872
+ for (const key of ['parentDatarooms', 'subDatarooms', 'webSearchEnabled', 'agenticMode', 'workflowId']) {
1873
+ if (additionalFields[key] !== undefined && additionalFields[key] !== '')
1874
+ form.append(key, String(additionalFields[key]));
1875
+ }
1876
+ const baseUrl = await getBaseUrl();
1877
+ responseData = await uploadRequest({
1878
+ method: 'POST',
1879
+ url: `${baseUrl}/api/chat/estimate`,
1880
+ body: form,
1881
+ });
1882
+ }
1883
+ else if (operation === 'tempChat') {
1884
+ const prompt = this.getNodeParameter('prompt', i);
1885
+ const model = this.getNodeParameter('model', i);
1886
+ const additionalFields = this.getNodeParameter('additionalFields', i, {});
1887
+ const form = new form_data_1.default();
1888
+ form.append('prompt', prompt);
1889
+ form.append('model', model);
1890
+ for (const key of ['connectedDatarooms', 'fileIds', 'imageIds']) {
1891
+ if (additionalFields[key]) {
1892
+ for (const val of splitCsv(additionalFields[key])) {
1893
+ form.append(key, val);
1894
+ }
1895
+ }
1896
+ }
1897
+ for (const key of ['webSearchEnabled', 'subDatarooms', 'parentDatarooms', 'workflowId']) {
1898
+ if (additionalFields[key] !== undefined && additionalFields[key] !== '')
1899
+ form.append(key, String(additionalFields[key]));
1900
+ }
1901
+ const baseUrl = await getBaseUrl();
1902
+ responseData = await uploadRequest({
1903
+ method: 'POST',
1904
+ url: `${baseUrl}/api/chat/temp`,
1905
+ body: form,
1906
+ });
1907
+ if (typeof responseData === 'string') {
1908
+ responseData = { result: responseData };
1909
+ }
1205
1910
  }
1206
1911
  }
1207
- // =============================================================
1208
- // MODEL
1209
- // =============================================================
1210
- if (resource === 'model') {
1912
+ // ── MODEL ────────────────────────────────────────────────
1913
+ else if (resource === 'model') {
1211
1914
  if (operation === 'getMany') {
1212
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', '/api/models');
1915
+ responseData = await apiReq('GET', '/api/models');
1213
1916
  }
1214
- if (operation === 'get') {
1917
+ else if (operation === 'get') {
1215
1918
  const modelId = this.getNodeParameter('modelId', i);
1216
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', `/api/models/${modelId}`);
1919
+ responseData = await apiReq('GET', `/api/models/${modelId}`);
1920
+ }
1921
+ else if (operation === 'getProcessing') {
1922
+ responseData = await apiReq('GET', '/api/models/processing');
1217
1923
  }
1218
- if (operation === 'getProcessing') {
1219
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', '/api/models/processing');
1924
+ else if (operation === 'getVlm') {
1925
+ responseData = await apiReq('GET', '/api/models/vlm');
1220
1926
  }
1221
- if (operation === 'getVlm') {
1222
- responseData = await GenericFunctions_1.aitezaApiRequest.call(this, 'GET', '/api/models/vlm');
1927
+ }
1928
+ // ── SEARCH ───────────────────────────────────────────────
1929
+ else if (resource === 'search') {
1930
+ if (operation === 'hybridSearch') {
1931
+ const query = this.getNodeParameter('searchQuery', i);
1932
+ const dataroomIdsRaw = this.getNodeParameter('dataroomIds', i, '');
1933
+ const additionalFields = this.getNodeParameter('additionalFields', i, {});
1934
+ const body = { query };
1935
+ if (dataroomIdsRaw)
1936
+ body.dataroomIds = splitCsv(dataroomIdsRaw);
1937
+ for (const key of ['topK', 'vectorThreshold', 'enableReranking', 'enableFullTextSearch']) {
1938
+ if (additionalFields[key] !== undefined)
1939
+ body[key] = additionalFields[key];
1940
+ }
1941
+ if (additionalFields.maxTokens && additionalFields.maxTokens > 0) {
1942
+ body.maxTokens = additionalFields.maxTokens;
1943
+ }
1944
+ responseData = await apiReq('POST', '/api/dataroom/search', body);
1945
+ }
1946
+ }
1947
+ // ── IDENTITY ─────────────────────────────────────────────
1948
+ else if (resource === 'identity') {
1949
+ if (operation === 'search') {
1950
+ const searchString = this.getNodeParameter('searchString', i, '');
1951
+ const qs = { searchString, ...buildPaginationQs(i) };
1952
+ responseData = await apiReq('GET', '/api/identity/search', {}, qs);
1223
1953
  }
1224
1954
  }
1225
1955
  // Normalize output
1226
1956
  if (responseData !== undefined) {
1227
- const items2 = Array.isArray(responseData)
1957
+ const outputItems = Array.isArray(responseData)
1228
1958
  ? responseData.map((item) => ({ json: item }))
1229
1959
  : [{ json: typeof responseData === 'object' ? responseData : { result: responseData } }];
1230
- returnData.push(...items2);
1960
+ returnData.push(...outputItems);
1231
1961
  }
1232
1962
  }
1233
1963
  catch (error) {