@processlink/node-red-contrib-processlink 1.2.1 → 1.2.3

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.
@@ -4,7 +4,10 @@
4
4
  "Bash(git add:*)",
5
5
  "Bash(git commit -m \"$\\(cat <<''EOF''\nAdd folder/area support to upload API\n\n- Add areaId and folderId params to /api/upload endpoint\n- Add API key auth to /api/sites/[siteId]/folders endpoint\n- Add new /api/sites/[siteId]/areas endpoint with API key auth\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
6
6
  "Bash(git commit -m \"$\\(cat <<''EOF''\nAdd location selector for file uploads \\(v1.2.0\\)\n\n- Add Location dropdown showing Area > Folder hierarchy\n- Fetch areas and folders from Files API with API key auth\n- Send areaId and folderId in upload requests\n- Update README documentation\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
7
- "Bash(npm publish:*)"
7
+ "Bash(npm publish:*)",
8
+ "WebFetch(domain:files.processlink.com.au)",
9
+ "Bash(git commit:*)",
10
+ "Bash(npm view:*)"
8
11
  ]
9
12
  }
10
13
  }
@@ -63,16 +63,27 @@ module.exports = function (RED) {
63
63
  let data = "";
64
64
  areasRes.on("data", (chunk) => (data += chunk));
65
65
  areasRes.on("end", () => {
66
- try {
67
- areasData = JSON.parse(data);
68
- } catch (e) {
66
+ if (areasRes.statusCode !== 200) {
67
+ console.log(`[ProcessLink] Areas API returned ${areasRes.statusCode}: ${data}`);
69
68
  areasData = [];
69
+ } else {
70
+ try {
71
+ areasData = JSON.parse(data);
72
+ if (!Array.isArray(areasData)) {
73
+ console.log(`[ProcessLink] Areas API returned non-array:`, areasData);
74
+ areasData = [];
75
+ }
76
+ } catch (e) {
77
+ console.log(`[ProcessLink] Areas API parse error:`, e.message);
78
+ areasData = [];
79
+ }
70
80
  }
71
81
  checkComplete();
72
82
  });
73
83
  }
74
84
  );
75
- areasReq.on("error", () => {
85
+ areasReq.on("error", (err) => {
86
+ console.log(`[ProcessLink] Areas request error:`, err.message);
76
87
  if (!hasError) {
77
88
  hasError = true;
78
89
  res.status(500).json({ error: "Failed to fetch areas" });
@@ -92,16 +103,27 @@ module.exports = function (RED) {
92
103
  let data = "";
93
104
  foldersRes.on("data", (chunk) => (data += chunk));
94
105
  foldersRes.on("end", () => {
95
- try {
96
- foldersData = JSON.parse(data);
97
- } catch (e) {
106
+ if (foldersRes.statusCode !== 200) {
107
+ console.log(`[ProcessLink] Folders API returned ${foldersRes.statusCode}: ${data}`);
98
108
  foldersData = [];
109
+ } else {
110
+ try {
111
+ foldersData = JSON.parse(data);
112
+ if (!Array.isArray(foldersData)) {
113
+ console.log(`[ProcessLink] Folders API returned non-array:`, foldersData);
114
+ foldersData = [];
115
+ }
116
+ } catch (e) {
117
+ console.log(`[ProcessLink] Folders API parse error:`, e.message);
118
+ foldersData = [];
119
+ }
99
120
  }
100
121
  checkComplete();
101
122
  });
102
123
  }
103
124
  );
104
- foldersReq.on("error", () => {
125
+ foldersReq.on("error", (err) => {
126
+ console.log(`[ProcessLink] Folders request error:`, err.message);
105
127
  if (!hasError) {
106
128
  hasError = true;
107
129
  res.status(500).json({ error: "Failed to fetch folders" });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.2.1",
6
+ "version": "1.2.3",
7
7
  "description": "Node-RED nodes for Process Link platform integration - upload files, send notifications, and connect to industrial automation systems",
8
8
  "keywords": [
9
9
  "node-red",