n8n-nodes-mautic-advanced 0.1.2 → 0.1.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.
@@ -55,7 +55,29 @@ async function mauticApiRequestAllItems(propertyName, method, endpoint, body = {
55
55
  query.start += query.limit;
56
56
  } while (responseData.total !== undefined &&
57
57
  returnData.length - parseInt(responseData.total, 10) < 0);
58
- return returnData;
58
+ // Deduplicate by 'id' property (defensive for all resources)
59
+ const seenIds = new Set();
60
+ const uniqueData = [];
61
+ for (const item of returnData) {
62
+ // Only deduplicate if item is an object
63
+ if (typeof item === 'object' && item !== null) {
64
+ // Defensive: support both direct id and nested id (e.g., item.fields?.id)
65
+ const id = item.id ?? item.fields?.id;
66
+ if (id !== undefined && !seenIds.has(id)) {
67
+ uniqueData.push(item);
68
+ seenIds.add(id);
69
+ }
70
+ else if (id === undefined) {
71
+ // If no id, include anyway (could be a non-standard object)
72
+ uniqueData.push(item);
73
+ }
74
+ }
75
+ else {
76
+ // If not an object, include anyway
77
+ uniqueData.push(item);
78
+ }
79
+ }
80
+ return uniqueData;
59
81
  }
60
82
  exports.mauticApiRequestAllItems = mauticApiRequestAllItems;
61
83
  function validateJSON(json) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-mautic-advanced",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Enhanced n8n node for Mautic with comprehensive API coverage including tags, campaigns, categories, and advanced contact management",
5
5
  "keywords": [
6
6
  "n8n",