n8n-nodes-script-runner 1.11.0 → 1.12.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.
@@ -76,6 +76,7 @@ async function fetchLinkedIn(accountId, url, totalLimit, apiKey, minDelaySec, ma
76
76
  }
77
77
  const addedThisPage = collected.length - beforeLength;
78
78
  const nextCursor = data.cursor ?? null;
79
+ const page_count = data.paging?.page_count ?? null;
79
80
  const estimatedTotal = data.paging?.total_count ?? null;
80
81
  // Store for final return
81
82
  if (estimatedTotal !== null)
@@ -110,8 +111,20 @@ async function fetchLinkedIn(accountId, url, totalLimit, apiKey, minDelaySec, ma
110
111
  else {
111
112
  consecutiveEmptyPages = 0;
112
113
  }
114
+ // Check if we've reached totalLimit
115
+ if (collected.length >= totalLimit) {
116
+ this.logger.info(`Reached totalLimit: ${collected.length}/${totalLimit}`);
117
+ return {
118
+ items: collected,
119
+ nextCursor: apiNextCursor,
120
+ lastFailedCursor: null,
121
+ estimatedTotal: apiEstimatedTotal ?? estimatedTotal,
122
+ error: null,
123
+ totalFetched: collected.length,
124
+ };
125
+ }
113
126
  // Continue only if needed
114
- if (collected.length < totalLimit) {
127
+ if (collected.length < totalLimit && page_count !== null && page_count >= PAGE_SIZE) {
115
128
  const delayMs = randomDelayMs(minDelaySec, maxDelaySec);
116
129
  this.logger.info(`Added ${addedThisPage} new items → total ${collected.length}/${totalLimit}. ` +
117
130
  `Waiting ~${Math.round(delayMs / 1000)} seconds...`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-script-runner",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Custom n8n nodes for script execution (jsdom, cheerio) and HTTP requests (axios, fetch)",
5
5
  "main": "index.js",
6
6
  "scripts": {