@aiteza/n8n-nodes-aiteza 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,7 @@ class Aiteza {
24
24
  name: 'aitezaOAuth2Api',
25
25
  required: true,
26
26
  displayOptions: {
27
- show: { authentication: ['credentials'] },
27
+ show: { authSource: ['credentials'] },
28
28
  },
29
29
  },
30
30
  ],
@@ -34,8 +34,9 @@ class Aiteza {
34
34
  // ------------------------------------------------------------------
35
35
  {
36
36
  displayName: 'Authentication',
37
- name: 'authentication',
37
+ name: 'authSource',
38
38
  type: 'options',
39
+ noDataExpression: true,
39
40
  options: [
40
41
  {
41
42
  name: 'OAuth2 Credentials',
@@ -45,7 +46,7 @@ class Aiteza {
45
46
  {
46
47
  name: 'From AITEZA Trigger',
47
48
  value: 'trigger',
48
- description: 'Use the auth token passed by an upstream AITEZA Trigger node (acts on behalf of the calling user)',
49
+ description: 'Use the auth token (and optionally base URL) passed by an upstream AITEZA Trigger node (acts on behalf of the calling user)',
49
50
  },
50
51
  ],
51
52
  default: 'credentials',
@@ -54,11 +55,10 @@ class Aiteza {
54
55
  displayName: 'AITEZA Base URL',
55
56
  name: 'baseUrl',
56
57
  type: 'string',
57
- required: true,
58
58
  default: '',
59
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.',
60
+ displayOptions: { show: { authSource: ['trigger'] } },
61
+ description: 'Base URL of the AITEZA backend (without trailing slash). Leave empty to use the URL forwarded by the upstream AITEZA Trigger node (_baseUrl in its output). Required if the trigger does not provide one.',
62
62
  },
63
63
  // ------------------------------------------------------------------
64
64
  // Resource
@@ -1111,13 +1111,6 @@ class Aiteza {
1111
1111
  type: 'boolean',
1112
1112
  default: false,
1113
1113
  },
1114
- {
1115
- displayName: 'Agentic Mode',
1116
- name: 'agenticMode',
1117
- type: 'boolean',
1118
- default: true,
1119
- description: 'Whether the LLM autonomously decides which datarooms and files to search',
1120
- },
1121
1114
  {
1122
1115
  displayName: 'Workflow ID',
1123
1116
  name: 'workflowId',
@@ -1371,7 +1364,7 @@ class Aiteza {
1371
1364
  const returnData = [];
1372
1365
  const resource = this.getNodeParameter('resource', 0);
1373
1366
  const operation = this.getNodeParameter('operation', 0);
1374
- const authMode = this.getNodeParameter('authentication', 0, 'credentials');
1367
+ const authMode = this.getNodeParameter('authSource', 0, 'credentials');
1375
1368
  let authCtx;
1376
1369
  if (authMode === 'trigger') {
1377
1370
  const triggerToken = (0, GenericFunctions_1.getUpstreamAuthToken)(this);
@@ -1379,9 +1372,10 @@ class Aiteza {
1379
1372
  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
1373
  'Make sure this node is connected to an AITEZA Trigger node.');
1381
1374
  }
1382
- const baseUrl = this.getNodeParameter('baseUrl', 0).replace(/\/+$/, '');
1375
+ const paramBaseUrl = this.getNodeParameter('baseUrl', 0, '').replace(/\/+$/, '');
1376
+ const baseUrl = paramBaseUrl || (0, GenericFunctions_1.getUpstreamBaseUrl)(this) || '';
1383
1377
  if (!baseUrl) {
1384
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'AITEZA Base URL is required when using trigger authentication.');
1378
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'AITEZA Base URL is required when using trigger authentication. Either set it on this node, or configure it on the upstream AITEZA Trigger node so it gets forwarded as _baseUrl.');
1385
1379
  }
1386
1380
  authCtx = { baseUrl, triggerToken };
1387
1381
  }
@@ -1838,7 +1832,7 @@ class Aiteza {
1838
1832
  }
1839
1833
  }
1840
1834
  }
1841
- for (const key of ['parentDatarooms', 'subDatarooms', 'webSearchEnabled', 'agenticMode', 'workflowId']) {
1835
+ for (const key of ['parentDatarooms', 'subDatarooms', 'webSearchEnabled', 'workflowId']) {
1842
1836
  if (additionalFields[key] !== undefined && additionalFields[key] !== '')
1843
1837
  form.append(key, String(additionalFields[key]));
1844
1838
  }
@@ -1869,7 +1863,7 @@ class Aiteza {
1869
1863
  }
1870
1864
  }
1871
1865
  }
1872
- for (const key of ['parentDatarooms', 'subDatarooms', 'webSearchEnabled', 'agenticMode', 'workflowId']) {
1866
+ for (const key of ['parentDatarooms', 'subDatarooms', 'webSearchEnabled', 'workflowId']) {
1873
1867
  if (additionalFields[key] !== undefined && additionalFields[key] !== '')
1874
1868
  form.append(key, String(additionalFields[key]));
1875
1869
  }
@@ -9,19 +9,21 @@ class AitezaTrigger {
9
9
  group: ['trigger'],
10
10
  version: 1,
11
11
  description: 'Starts the workflow when an AITEZA event is received via webhook. ' +
12
- 'Passes the caller\'s auth token to all downstream AITEZA nodes so they act on behalf of the triggering user.',
12
+ 'Passes the caller\'s auth token (and optionally the AITEZA Base URL) to all downstream AITEZA nodes so they act on behalf of the triggering user.',
13
13
  defaults: { name: 'AITEZA Trigger' },
14
14
  inputs: [],
15
15
  outputs: ['main'],
16
16
  // No credentials required – the trigger just receives webhooks.
17
- // Downstream AITEZA nodes still need credentials (for baseUrl), but will
18
- // use the token from this trigger for actual authentication.
17
+ // Downstream AITEZA nodes still need a base URL (taken from this trigger
18
+ // or from configured credentials) and will use the token from this
19
+ // trigger for actual authentication.
19
20
  credentials: [],
20
21
  webhooks: [
21
22
  {
22
23
  name: 'default',
23
24
  httpMethod: 'POST',
24
25
  responseMode: '={{$parameter["responseMode"]}}',
26
+ responseData: '={{$parameter["responseMode"] === "lastNode" ? "allEntries" : undefined}}',
25
27
  path: '={{$parameter["path"]}}',
26
28
  isFullPath: true,
27
29
  },
@@ -40,31 +42,53 @@ class AitezaTrigger {
40
42
  displayName: 'Response Mode',
41
43
  name: 'responseMode',
42
44
  type: 'options',
45
+ noDataExpression: true,
43
46
  options: [
47
+ {
48
+ name: 'Immediately',
49
+ value: 'onReceived',
50
+ description: 'Respond immediately with 200 OK as soon as the webhook is received',
51
+ },
44
52
  {
45
53
  name: 'When Last Node Finishes',
46
54
  value: 'lastNode',
47
55
  description: 'Respond with data from the last node in the workflow',
48
56
  },
49
57
  {
50
- name: 'Immediately',
51
- value: 'onReceived',
52
- description: 'Respond immediately with 200 OK',
58
+ name: 'Using \'Respond to Webhook\' Node',
59
+ value: 'responseNode',
60
+ description: 'Respond using the data from a downstream "Respond to Webhook" node',
53
61
  },
54
62
  ],
55
63
  default: 'lastNode',
56
64
  description: 'When and how to respond to the webhook',
57
65
  },
66
+ {
67
+ displayName: 'AITEZA Base URL',
68
+ name: 'baseUrl',
69
+ type: 'string',
70
+ default: '',
71
+ placeholder: 'https://aiteza.example.com',
72
+ description: 'Optional. If set, this URL is forwarded to downstream AITEZA nodes (as _baseUrl) so they don\'t need to repeat it. Without trailing slash.',
73
+ },
58
74
  ],
59
75
  };
60
76
  async webhook() {
61
77
  const body = this.getBodyData();
62
78
  const headers = this.getHeaderData();
79
+ const query = this.getQueryData();
63
80
  const authHeader = headers.authorization || headers.Authorization || '';
64
81
  const authToken = authHeader.replace(/^Bearer\s+/i, '');
65
- const outputData = { ...body };
82
+ const baseUrl = this.getNodeParameter('baseUrl', '').replace(/\/+$/, '');
83
+ const outputData = {
84
+ body,
85
+ headers,
86
+ query,
87
+ };
66
88
  if (authToken)
67
89
  outputData._authToken = authToken;
90
+ if (baseUrl)
91
+ outputData._baseUrl = baseUrl;
68
92
  return {
69
93
  workflowData: [this.helpers.returnJsonArray(outputData)],
70
94
  };
@@ -4,6 +4,7 @@ export interface AitezaAuthContext {
4
4
  triggerToken?: string;
5
5
  }
6
6
  export declare function getUpstreamAuthToken(ef: IExecuteFunctions): string | undefined;
7
+ export declare function getUpstreamBaseUrl(ef: IExecuteFunctions): string | undefined;
7
8
  export declare function aitezaApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject | IDataObject[], qs?: IDataObject, extraOpts?: Partial<IHttpRequestOptions>, authCtx?: AitezaAuthContext): Promise<any>;
8
9
  export declare function aitezaApiRequestFullResponse(this: IExecuteFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject, extraOpts?: Partial<IHttpRequestOptions>, authCtx?: AitezaAuthContext): Promise<{
9
10
  body: any;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getUpstreamAuthToken = getUpstreamAuthToken;
4
+ exports.getUpstreamBaseUrl = getUpstreamBaseUrl;
4
5
  exports.aitezaApiRequest = aitezaApiRequest;
5
6
  exports.aitezaApiRequestFullResponse = aitezaApiRequestFullResponse;
6
7
  exports.loadDatarooms = loadDatarooms;
@@ -28,6 +29,20 @@ function getUpstreamAuthToken(ef) {
28
29
  }
29
30
  return undefined;
30
31
  }
32
+ function getUpstreamBaseUrl(ef) {
33
+ try {
34
+ const items = ef.getInputData();
35
+ for (const item of items) {
36
+ const url = item.json?._baseUrl;
37
+ if (url)
38
+ return url.replace(/\/+$/, '');
39
+ }
40
+ }
41
+ catch {
42
+ // ignore
43
+ }
44
+ return undefined;
45
+ }
31
46
  // ---------------------------------------------------------------------------
32
47
  // Internal helpers
33
48
  // ---------------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiteza/n8n-nodes-aiteza",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "n8n Community Node for the AITEZA REST API (Datarooms, Files, Chat, Search, Workflows)",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",