@processlink/node-red-contrib-processlink 1.0.1 → 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.
package/CHANGELOG.md CHANGED
@@ -5,7 +5,20 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [1.0.1] - 2025-02-05
8
+ ## [1.0.4] - 2025-02-05
9
+
10
+ ### Added
11
+
12
+ - Timestamp prefix option: automatically prefix filenames with `YYYY-MM-DD_HH-MM-SS_`
13
+ - Improved filename documentation explaining how it appears in Process Link Files
14
+
15
+ ## [1.0.3] - 2025-02-05
16
+
17
+ ### Added
18
+
19
+ - Importable JSON example flow in README for easy customer onboarding
20
+
21
+ ## [1.0.2] - 2025-02-05
9
22
 
10
23
  ### Changed
11
24
 
package/README.md CHANGED
@@ -116,17 +116,79 @@ Uploads files to the Process Link Files API.
116
116
  | 🟢 Green | Upload successful |
117
117
  | 🔴 Red | Error occurred |
118
118
 
119
- ## Examples
120
-
121
- ### Basic File Upload
122
-
123
- ```
124
- [File In] → [files upload] → [Debug]
119
+ ## Example Flow (Copy & Import)
120
+
121
+ Copy the JSON below and import it into Node-RED: **Menu → Import → Clipboard**
122
+
123
+ ```json
124
+ [
125
+ {
126
+ "id": "pl-inject",
127
+ "type": "inject",
128
+ "z": "",
129
+ "name": "Upload File",
130
+ "props": [],
131
+ "repeat": "",
132
+ "crontab": "",
133
+ "once": false,
134
+ "onceDelay": 0.1,
135
+ "topic": "",
136
+ "x": 110,
137
+ "y": 100,
138
+ "wires": [["pl-file-in"]]
139
+ },
140
+ {
141
+ "id": "pl-file-in",
142
+ "type": "file in",
143
+ "z": "",
144
+ "name": "Read File",
145
+ "filename": "/tmp/myfile.csv",
146
+ "filenameType": "str",
147
+ "format": "",
148
+ "chunk": false,
149
+ "sendError": false,
150
+ "encoding": "none",
151
+ "allProps": true,
152
+ "x": 270,
153
+ "y": 100,
154
+ "wires": [["pl-upload"]]
155
+ },
156
+ {
157
+ "id": "pl-upload",
158
+ "type": "processlink-files-upload",
159
+ "z": "",
160
+ "name": "Upload to Process Link",
161
+ "server": "",
162
+ "filename": "",
163
+ "timeout": "30000",
164
+ "apiUrl": "https://files.processlink.com.au/api/upload",
165
+ "x": 470,
166
+ "y": 100,
167
+ "wires": [["pl-debug"]]
168
+ },
169
+ {
170
+ "id": "pl-debug",
171
+ "type": "debug",
172
+ "z": "",
173
+ "name": "Result",
174
+ "active": true,
175
+ "tosidebar": true,
176
+ "console": false,
177
+ "tostatus": false,
178
+ "complete": "true",
179
+ "targetType": "full",
180
+ "x": 650,
181
+ "y": 100,
182
+ "wires": []
183
+ }
184
+ ]
125
185
  ```
126
186
 
127
- 1. Configure a **File In** node to read your file
128
- 2. Connect it to the **files upload** node
129
- 3. Add a **Debug** node to see the response
187
+ **After importing:**
188
+ 1. Double-click the **Read File** node → change the file path to your file
189
+ 2. Double-click the **Upload to Process Link** node click the pencil icon → enter your **Site ID** and **API Key**
190
+ 3. Click **Deploy**
191
+ 4. Click the inject button to upload
130
192
 
131
193
  ### Dynamic Filename
132
194
 
@@ -190,4 +252,4 @@ Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md)
190
252
 
191
253
  ## License
192
254
 
193
- [MIT](LICENSE) © [Process Link](https://processlink.com.au)
255
+ [MIT](LICENSE)
@@ -50,7 +50,7 @@
50
50
  <dt>Name <span class="property-type">string</span></dt>
51
51
  <dd>Optional friendly name for this configuration.</dd>
52
52
  <dt>Site ID <span class="property-type">string</span></dt>
53
- <dd>The UUID of your site from Process Link. Found in your site settings.</dd>
53
+ <dd>The UUID of your site from Process Link. Found in your organisation settings under Developer.</dd>
54
54
  <dt>API Key <span class="property-type">string</span></dt>
55
55
  <dd>
56
56
  The API key for authentication. Generate one from Developer → API Keys in the Process Link Portal.
@@ -6,6 +6,7 @@
6
6
  name: { value: "" },
7
7
  server: { value: "", type: "processlink-config", required: true },
8
8
  filename: { value: "" },
9
+ timestampPrefix: { value: false },
9
10
  timeout: { value: "30000" },
10
11
  apiUrl: { value: "https://files.processlink.com.au/api/upload" },
11
12
  },
@@ -37,6 +38,11 @@
37
38
  <label for="node-input-filename"><i class="fa fa-file"></i> Filename</label>
38
39
  <input type="text" id="node-input-filename" placeholder="msg.filename (or specify default)" />
39
40
  </div>
41
+ <div class="form-row">
42
+ <label for="node-input-timestampPrefix">&nbsp;</label>
43
+ <input type="checkbox" id="node-input-timestampPrefix" style="width: auto; margin-right: 10px;">
44
+ <span>Prefix filename with timestamp (YYYY-MM-DD_HH-MM-SS_)</span>
45
+ </div>
40
46
  <div class="form-row">
41
47
  <label for="node-input-timeout"><i class="fa fa-clock-o"></i> Timeout</label>
42
48
  <input type="text" id="node-input-timeout" placeholder="30000" />
@@ -56,7 +62,17 @@
56
62
  <dt>payload <span class="property-type">buffer | string</span></dt>
57
63
  <dd>The file content to upload.</dd>
58
64
  <dt class="optional">filename <span class="property-type">string</span></dt>
59
- <dd>The filename to use. Defaults to the configured filename or "file.bin".</dd>
65
+ <dd>The filename that will appear in Process Link Files. Can be set via <code>msg.filename</code> or configured in the node. Defaults to "file.bin" if not set. Any path is stripped (e.g., <code>/tmp/report.csv</code> becomes <code>report.csv</code>).</dd>
66
+ </dl>
67
+
68
+ <h3>Configuration</h3>
69
+ <dl class="message-properties">
70
+ <dt>Filename <span class="property-type">string</span></dt>
71
+ <dd>Default filename to use if <code>msg.filename</code> is not set.</dd>
72
+ <dt>Prefix with timestamp <span class="property-type">boolean</span></dt>
73
+ <dd>When enabled, automatically prefixes the filename with a timestamp in the format <code>YYYY-MM-DD_HH-MM-SS_</code>. For example, <code>report.csv</code> becomes <code>2025-02-05_14-30-45_report.csv</code>.</dd>
74
+ <dt>Timeout <span class="property-type">number</span></dt>
75
+ <dd>Request timeout in milliseconds. Default is 30000 (30 seconds).</dd>
60
76
  </dl>
61
77
 
62
78
  <h3>Outputs</h3>
@@ -55,7 +55,19 @@ module.exports = function (RED) {
55
55
 
56
56
  // Get filename
57
57
  const filename = msg.filename || config.filename || "file.bin";
58
- const basename = filename.split(/[\\/]/).pop();
58
+ let basename = filename.split(/[\\/]/).pop();
59
+
60
+ // Add timestamp prefix if enabled
61
+ if (config.timestampPrefix) {
62
+ const now = new Date();
63
+ const timestamp = now.getFullYear() + "-" +
64
+ String(now.getMonth() + 1).padStart(2, "0") + "-" +
65
+ String(now.getDate()).padStart(2, "0") + "_" +
66
+ String(now.getHours()).padStart(2, "0") + "-" +
67
+ String(now.getMinutes()).padStart(2, "0") + "-" +
68
+ String(now.getSeconds()).padStart(2, "0");
69
+ basename = timestamp + "_" + basename;
70
+ }
59
71
 
60
72
  // Build multipart form data
61
73
  const boundary = "----NodeREDProcessLink" + Date.now() + Math.random().toString(36).substring(2);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.0.1",
6
+ "version": "1.0.4",
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",