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