n8n-nodes-script-runner 1.11.0 → 1.13.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,6 +111,18 @@ 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 || (estimatedTotal !== null && collected.length >= estimatedTotal) || (page_count !== null && page_count < PAGE_SIZE)) {
|
|
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
127
|
if (collected.length < totalLimit) {
|
|
115
128
|
const delayMs = randomDelayMs(minDelaySec, maxDelaySec);
|