n8n-nodes-tenable 1.0.2 → 1.0.4

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.
@@ -11,15 +11,16 @@ async function tenableApiRequest(method, endpoint, body = {}, qs = {}) {
11
11
  url: `${credentials.baseUrl}${endpoint}`,
12
12
  headers: {
13
13
  'Accept': 'application/json',
14
- 'Content-Type': 'application/json',
15
14
  },
16
15
  qs,
17
- body,
18
- json: true,
19
16
  };
20
- // Only remove body for GET requests - POST/PUT requests may need empty body
21
- if (Object.keys(body).length === 0 && method === 'GET') {
22
- delete options.body;
17
+ // For non-GET requests, always send JSON body (even if empty)
18
+ if (method !== 'GET') {
19
+ options.body = JSON.stringify(body);
20
+ options.headers = {
21
+ ...options.headers,
22
+ 'Content-Type': 'application/json',
23
+ };
23
24
  }
24
25
  if (Object.keys(qs).length === 0) {
25
26
  delete options.qs;
@@ -1041,11 +1041,45 @@ class TenableVulnerabilityManagement {
1041
1041
  if (resource === 'asset') {
1042
1042
  if (operation === 'getAll') {
1043
1043
  const returnAll = this.getNodeParameter('returnAll', i);
1044
- const response = (await GenericFunctions_1.tenableApiRequest.call(this, 'GET', '/assets'));
1045
- responseData = response.assets;
1046
- if (!returnAll) {
1044
+ if (returnAll) {
1045
+ // Fetch all assets using pagination (max 5000 per page)
1046
+ const allAssets = [];
1047
+ const pageSize = 5000;
1048
+ let page = 0;
1049
+ let hasMore = true;
1050
+ while (hasMore) {
1051
+ const qs = {
1052
+ size: pageSize,
1053
+ page: page,
1054
+ };
1055
+ const response = (await GenericFunctions_1.tenableApiRequest.call(this, 'GET', '/assets', {}, qs));
1056
+ const assets = response.assets;
1057
+ if (assets && assets.length > 0) {
1058
+ allAssets.push(...assets);
1059
+ // If we got less than pageSize, we've reached the end
1060
+ if (assets.length < pageSize) {
1061
+ hasMore = false;
1062
+ }
1063
+ else {
1064
+ page++;
1065
+ }
1066
+ }
1067
+ else {
1068
+ hasMore = false;
1069
+ }
1070
+ }
1071
+ responseData = allAssets;
1072
+ }
1073
+ else {
1047
1074
  const limit = this.getNodeParameter('limit', i);
1048
- responseData = responseData.slice(0, limit);
1075
+ const qs = {
1076
+ size: Math.min(limit, 5000),
1077
+ };
1078
+ const response = (await GenericFunctions_1.tenableApiRequest.call(this, 'GET', '/assets', {}, qs));
1079
+ responseData = response.assets;
1080
+ if (responseData && limit < responseData.length) {
1081
+ responseData = responseData.slice(0, limit);
1082
+ }
1049
1083
  }
1050
1084
  }
1051
1085
  if (operation === 'get') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-tenable",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "n8n nodes for Tenable Vulnerability Management and Tenable One APIs",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",