@flowfuse/nr-file-nodes 0.0.9-fd5648d-202601050929.0 → 0.0.10-c4a6014-202602031410.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.
- package/CHANGELOG.md +47 -0
- package/eslint.config.mjs +19 -19
- package/file.html +208 -208
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,50 @@
|
|
|
1
|
+
#### 0.0.9: Release
|
|
2
|
+
|
|
3
|
+
- Move from flowforge/file-server to flowfuse/file-server
|
|
4
|
+
- Bump flowfuse/github-actions-workflows/.github/workflows/build_node_package.yml (#126)
|
|
5
|
+
- Bump actions/checkout from 6.0.1 to 6.0.2 (#125)
|
|
6
|
+
- Bump flowfuse/github-actions-workflows/.github/workflows/sast_scan.yaml (#124)
|
|
7
|
+
- Bump flowfuse/github-actions-workflows/.github/workflows/publish_node_package.yml (#127)
|
|
8
|
+
- Bump flowfuse/github-actions-workflows/.github/workflows/publish_node_package.yml (#120)
|
|
9
|
+
- Bump flowfuse/github-actions-workflows/.github/workflows/build_node_package.yml (#121)
|
|
10
|
+
- Bump actions/setup-node from 6.1.0 to 6.2.0 (#119)
|
|
11
|
+
- Bump JS-DevTools/npm-publish from 4.1.1 to 4.1.3 (#117)
|
|
12
|
+
- Bump flowfuse/github-actions-workflows from 0.42.0 to 0.43.0 (#100)
|
|
13
|
+
- Bump actions/setup-node from 5.0.0 to 6.0.0 (#99)
|
|
14
|
+
- Bump JS-DevTools/npm-publish from 4.0.1 to 4.1.1 (#98)
|
|
15
|
+
- Bump actions/setup-node from 4.4.0 to 5.0.0 (#95)
|
|
16
|
+
- Bump actions/checkout from 4.2.2 to 5.0.0 (#93)
|
|
17
|
+
- Bump flowfuse/github-actions-workflows from 0.40.0 to 0.42.0 (#94)
|
|
18
|
+
- Bump flowfuse/github-actions-workflows from 0.39.0 to 0.40.0 (#91)
|
|
19
|
+
- Bump actions/setup-node from 4.3.0 to 4.4.0 (#86)
|
|
20
|
+
- Bump nr and test helper for deps (#128) @hardillb
|
|
21
|
+
- Bump JS-DevTools/npm-publish from 4.1.3 to 4.1.4 (#122) @app/dependabot
|
|
22
|
+
- Bump lodash from 4.17.21 to 4.17.23 (#123) @app/dependabot
|
|
23
|
+
- ci: Enable SAST (#118) @ppawlowski
|
|
24
|
+
- Fix eqeqeq (#114) @hardillb
|
|
25
|
+
- Fix eslint rules for quotes and eqeqeq (#113) @hardillb
|
|
26
|
+
- Convert to eslint v9 (#112) @hardillb
|
|
27
|
+
- Bump flowfuse/github-actions-workflows/.github/workflows/publish_node_package.yml from 0.44.0 to 0.45.0 (#109) @app/dependabot
|
|
28
|
+
- Bump flowfuse/github-actions-workflows/.github/workflows/build_node_package.yml from 0.44.0 to 0.45.0 (#108) @app/dependabot
|
|
29
|
+
- Bump js-yaml deep dependency (#110) @hardillb
|
|
30
|
+
- Bump flowfuse/github-actions-workflows/.github/workflows/build_node_package.yml from 0.43.0 to 0.44.0 (#106) @app/dependabot
|
|
31
|
+
- Bump flowfuse/github-actions-workflows/.github/workflows/publish_node_package.yml from 0.43.0 to 0.44.0 (#107) @app/dependabot
|
|
32
|
+
- Bump actions/checkout from 6.0.0 to 6.0.1 (#105) @app/dependabot
|
|
33
|
+
- Bump actions/setup-node from 6.0.0 to 6.1.0 (#104) @app/dependabot
|
|
34
|
+
- Bump validator from 13.15.20 to 13.15.23 (#103) @app/dependabot
|
|
35
|
+
- Bump actions/checkout from 5.0.0 to 6.0.0 (#102) @app/dependabot
|
|
36
|
+
- Bump validator from 13.9.0 to 13.15.20 (#101) @app/dependabot
|
|
37
|
+
- Bump JS-DevTools/npm-publish from 3.1.1 to 4.0.1 (#97) @app/dependabot
|
|
38
|
+
- Bump form-data and node-red (#92) @app/dependabot
|
|
39
|
+
- Bump cookie, light-my-request, node-red and express (#90) @app/dependabot
|
|
40
|
+
- Bump serialize-javascript and mocha (#88) @app/dependabot
|
|
41
|
+
- Bump axios from 1.7.4 to 1.9.0 (#89) @app/dependabot
|
|
42
|
+
- Bump node-red-node-test-helper to pick up dep (#87) @hardillb
|
|
43
|
+
- chore: fix lint script (#85) @ppawlowski
|
|
44
|
+
- Bump axios from 1.7.4 to 1.8.4 (#84) @app/dependabot
|
|
45
|
+
- chore: Pin external actions to commit hash (#83) @ppawlowski
|
|
46
|
+
- Bump serialize-javascript and mocha (#82) @app/dependabot
|
|
47
|
+
|
|
1
48
|
#### 0.0.8: Release
|
|
2
49
|
|
|
3
50
|
- Bump flowfuse/github-actions-workflows from 0.37.0 to 0.38.0 (#80)
|
package/eslint.config.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import globals from
|
|
2
|
-
import html from
|
|
3
|
-
import js from
|
|
1
|
+
import globals from 'globals'
|
|
2
|
+
import html from 'eslint-plugin-html'
|
|
3
|
+
import js from '@eslint/js'
|
|
4
4
|
import neostandard, { resolveIgnoresFromGitignore } from 'neostandard'
|
|
5
5
|
import stylistic from '@stylistic/eslint-plugin'
|
|
6
6
|
import noOnlyTests from 'eslint-plugin-no-only-tests'
|
|
7
7
|
|
|
8
8
|
export default [
|
|
9
9
|
{
|
|
10
|
-
files: [
|
|
10
|
+
files: ['**/*.js'],
|
|
11
11
|
languageOptions: {
|
|
12
12
|
globals: {
|
|
13
13
|
...globals.browser
|
|
14
14
|
},
|
|
15
|
-
sourceType:
|
|
15
|
+
sourceType: 'script'
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
{
|
|
@@ -26,11 +26,11 @@ export default [
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
files: [
|
|
29
|
+
files: ['**/*.html'],
|
|
30
30
|
plugins: { html },
|
|
31
31
|
settings: {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
'html/indent': 'space',
|
|
33
|
+
'html/report-bad-indent': 'error'
|
|
34
34
|
},
|
|
35
35
|
languageOptions: {
|
|
36
36
|
globals: {
|
|
@@ -50,25 +50,25 @@ export default [
|
|
|
50
50
|
...neostandard(),
|
|
51
51
|
{
|
|
52
52
|
plugins: {
|
|
53
|
-
|
|
53
|
+
'@stylistic': stylistic,
|
|
54
54
|
'no-only-tests': noOnlyTests
|
|
55
55
|
},
|
|
56
56
|
rules: {
|
|
57
57
|
'object-shorthand': ['error'],
|
|
58
58
|
'no-console': ['error', { allow: ['debug', 'info', 'warn', 'error'] }],
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
'camelcase': 'off',
|
|
61
|
+
'eqeqeq': 'error',
|
|
62
|
+
'no-empty': ['error', { 'allowEmptyCatch': true }],
|
|
63
|
+
'no-unused-vars': ['error', {
|
|
64
|
+
'args': 'none',
|
|
65
|
+
'caughtErrors': 'none'
|
|
66
66
|
}],
|
|
67
|
-
|
|
67
|
+
'quotes': ['off', 'error', 'single', { 'avoidEscape': true }],
|
|
68
|
+
'yoda': 'off',
|
|
68
69
|
'@stylistic/indent': ['warn', 4], // https://eslint.style/rules/indent#options
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"@stylistic/quote-props": ["warn", "consistent"],
|
|
70
|
+
'@stylistic/linebreak-style': ['error', 'unix'],
|
|
71
|
+
'@stylistic/quote-props': ['warn', 'consistent'],
|
|
72
72
|
'@stylistic/no-multi-spaces': 'error', // https://eslint.style/rules/no-multi-spaces#no-multi-spaces
|
|
73
73
|
'@stylistic/comma-dangle': ['error', 'never'] // https://eslint.style/rules/comma-dangle#comma-dangle
|
|
74
74
|
}
|
package/file.html
CHANGED
|
@@ -76,234 +76,234 @@
|
|
|
76
76
|
(function () {
|
|
77
77
|
const encodings = [
|
|
78
78
|
[
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
'file.encoding.native',
|
|
80
|
+
'utf8',
|
|
81
|
+
'ucs2',
|
|
82
|
+
'utf-16le',
|
|
83
|
+
'ascii',
|
|
84
|
+
'binary',
|
|
85
|
+
'base64',
|
|
86
|
+
'hex'
|
|
87
87
|
],
|
|
88
88
|
[
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
'file.encoding.unicode',
|
|
90
|
+
'utf-16be'
|
|
91
91
|
],
|
|
92
92
|
[
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
'file.encoding.japanese',
|
|
94
|
+
'Shift_JIS',
|
|
95
|
+
'Windows-31j',
|
|
96
|
+
'Windows932',
|
|
97
|
+
'EUC-JP'
|
|
98
98
|
],
|
|
99
99
|
[
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
'file.encoding.chinese',
|
|
101
|
+
'GB2312',
|
|
102
|
+
'GBK',
|
|
103
|
+
'GB18030',
|
|
104
|
+
'Windows936',
|
|
105
|
+
'EUC-CN'
|
|
106
106
|
],
|
|
107
107
|
[
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
'file.encoding.korean',
|
|
109
|
+
'KS_C_5601',
|
|
110
|
+
'Windows949',
|
|
111
|
+
'EUC-KR'
|
|
112
112
|
],
|
|
113
113
|
[
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
'file.encoding.taiwan',
|
|
115
|
+
'Big5',
|
|
116
|
+
'Big5-HKSCS',
|
|
117
|
+
'Windows950'
|
|
118
118
|
],
|
|
119
119
|
[
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
120
|
+
'file.encoding.windows',
|
|
121
|
+
'cp874',
|
|
122
|
+
'cp1250',
|
|
123
|
+
'cp1251',
|
|
124
|
+
'cp1252',
|
|
125
|
+
'cp1253',
|
|
126
|
+
'cp1254',
|
|
127
|
+
'cp1255',
|
|
128
|
+
'cp1256',
|
|
129
|
+
'cp1257',
|
|
130
|
+
'cp1258'
|
|
131
131
|
],
|
|
132
132
|
[
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
133
|
+
'file.encoding.iso',
|
|
134
|
+
'ISO-8859-1',
|
|
135
|
+
'ISO-8859-2',
|
|
136
|
+
'ISO-8859-3',
|
|
137
|
+
'ISO-8859-4',
|
|
138
|
+
'ISO-8859-5',
|
|
139
|
+
'ISO-8859-6',
|
|
140
|
+
'ISO-8859-7',
|
|
141
|
+
'ISO-8859-8',
|
|
142
|
+
'ISO-8859-9',
|
|
143
|
+
'ISO-8859-10',
|
|
144
|
+
'ISO-8859-11',
|
|
145
|
+
'ISO-8859-12',
|
|
146
|
+
'ISO-8859-13',
|
|
147
|
+
'ISO-8859-14',
|
|
148
|
+
'ISO-8859-15',
|
|
149
|
+
'ISO-8859-16'
|
|
150
150
|
],
|
|
151
151
|
[
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
152
|
+
'file.encoding.ibm',
|
|
153
|
+
'cp437',
|
|
154
|
+
'cp737',
|
|
155
|
+
'cp775',
|
|
156
|
+
'cp808',
|
|
157
|
+
'cp850',
|
|
158
|
+
'cp852',
|
|
159
|
+
'cp855',
|
|
160
|
+
'cp856',
|
|
161
|
+
'cp857',
|
|
162
|
+
'cp858',
|
|
163
|
+
'cp860',
|
|
164
|
+
'cp861',
|
|
165
|
+
'cp866',
|
|
166
|
+
'cp869',
|
|
167
|
+
'cp922',
|
|
168
|
+
'cp1046',
|
|
169
|
+
'cp1124',
|
|
170
|
+
'cp1125',
|
|
171
|
+
'cp1129',
|
|
172
|
+
'cp1133',
|
|
173
|
+
'cp1161',
|
|
174
|
+
'cp1162',
|
|
175
|
+
'cp1163'
|
|
176
176
|
],
|
|
177
177
|
[
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
178
|
+
'file.encoding.mac',
|
|
179
|
+
'maccroatian',
|
|
180
|
+
'maccyrillic',
|
|
181
|
+
'macgreek',
|
|
182
|
+
'maciceland',
|
|
183
|
+
'macroman',
|
|
184
|
+
'macromania',
|
|
185
|
+
'macthai',
|
|
186
|
+
'macturkish',
|
|
187
|
+
'macukraine',
|
|
188
|
+
'maccenteuro',
|
|
189
|
+
'macintosh'
|
|
190
190
|
],
|
|
191
191
|
[
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
192
|
+
'file.encoding.koi8',
|
|
193
|
+
'koi8-r',
|
|
194
|
+
'koi8-u',
|
|
195
|
+
'koi8-ru',
|
|
196
|
+
'koi8-t'
|
|
197
197
|
],
|
|
198
198
|
[
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
199
|
+
'file.encoding.misc',
|
|
200
|
+
'armscii8',
|
|
201
|
+
'rk1048',
|
|
202
|
+
'tcvn',
|
|
203
|
+
'georgianacademy',
|
|
204
|
+
'georgianps',
|
|
205
|
+
'pt154',
|
|
206
|
+
'viscii',
|
|
207
|
+
'iso646cn',
|
|
208
|
+
'iso646jp',
|
|
209
|
+
'hproman8',
|
|
210
|
+
'tis620'
|
|
211
211
|
]
|
|
212
212
|
]
|
|
213
213
|
|
|
214
214
|
RED.nodes.registerType('file', {
|
|
215
215
|
category: 'storage',
|
|
216
216
|
defaults: {
|
|
217
|
-
name: { value:
|
|
218
|
-
filename: { value:
|
|
219
|
-
filenameType: { value:
|
|
217
|
+
name: { value: '' },
|
|
218
|
+
filename: { value: '' },
|
|
219
|
+
filenameType: { value: 'str' },
|
|
220
220
|
appendNewline: { value: true },
|
|
221
221
|
createDir: { value: false },
|
|
222
|
-
overwriteFile: { value:
|
|
223
|
-
encoding: { value:
|
|
222
|
+
overwriteFile: { value: 'false' },
|
|
223
|
+
encoding: { value: 'none' }
|
|
224
224
|
},
|
|
225
|
-
color:
|
|
225
|
+
color: 'BurlyWood',
|
|
226
226
|
inputs: 1,
|
|
227
227
|
outputs: 1,
|
|
228
|
-
icon:
|
|
228
|
+
icon: 'file-out.svg',
|
|
229
229
|
label: function () {
|
|
230
230
|
let fn = this.filename
|
|
231
|
-
if (this.filenameType
|
|
232
|
-
if (this.filenameType ===
|
|
233
|
-
if (this.overwriteFile ===
|
|
234
|
-
return this.name || this._(
|
|
231
|
+
if (this.filenameType !== 'str' && this.filenameType !== 'env') { fn = '' }
|
|
232
|
+
if (this.filenameType === 'env') { fn = 'env.' + fn }
|
|
233
|
+
if (this.overwriteFile === 'delete') {
|
|
234
|
+
return this.name || this._('file.label.deletelabel', { file: fn })
|
|
235
235
|
} else {
|
|
236
|
-
return this.name || fn || this._(
|
|
236
|
+
return this.name || fn || this._('file.label.write')
|
|
237
237
|
}
|
|
238
238
|
},
|
|
239
|
-
paletteLabel: RED._(
|
|
239
|
+
paletteLabel: RED._('node-red:file.label.write'),
|
|
240
240
|
labelStyle: function () {
|
|
241
|
-
return this.name ?
|
|
241
|
+
return this.name ? 'node_label_italic' : ''
|
|
242
242
|
},
|
|
243
243
|
oneditprepare: function () {
|
|
244
244
|
const node = this
|
|
245
|
-
const encSel = $(
|
|
246
|
-
const label = node._(
|
|
247
|
-
$(
|
|
248
|
-
value:
|
|
245
|
+
const encSel = $('#node-input-encoding')
|
|
246
|
+
const label = node._('file.encoding.none')
|
|
247
|
+
$('<option/>', {
|
|
248
|
+
value: 'none',
|
|
249
249
|
label
|
|
250
250
|
}).text(label).appendTo(encSel)
|
|
251
|
-
$(
|
|
252
|
-
value:
|
|
253
|
-
label: node._(
|
|
251
|
+
$('<option/>', {
|
|
252
|
+
value: 'setbymsg',
|
|
253
|
+
label: node._('file.encoding.setbymsg')
|
|
254
254
|
}).text(label).appendTo(encSel)
|
|
255
|
-
$(
|
|
256
|
-
default:
|
|
257
|
-
types: [{ label: RED._(
|
|
258
|
-
typeField: $(
|
|
255
|
+
$('#node-input-filename').typedInput({
|
|
256
|
+
default: 'str',
|
|
257
|
+
types: [{ label: RED._('node-red:file.label.path'), value: 'str', icon: '' }, 'msg', 'jsonata', 'env'],
|
|
258
|
+
typeField: $('#node-input-filenameType')
|
|
259
259
|
})
|
|
260
|
-
if (typeof node.filenameType
|
|
260
|
+
if (typeof node.filenameType === 'undefined') {
|
|
261
261
|
// existing node AND filenameType is not set - inplace (compatible) upgrade to new typedInput
|
|
262
|
-
if (node.filename
|
|
263
|
-
node.filename =
|
|
264
|
-
node.filenameType =
|
|
265
|
-
$(
|
|
266
|
-
$(
|
|
262
|
+
if (node.filename === '') { // was using empty value to denote msg.filename - set typedInput to match
|
|
263
|
+
node.filename = 'filename'
|
|
264
|
+
node.filenameType = 'msg'
|
|
265
|
+
$('#node-input-filename').typedInput('type', node.filenameType)
|
|
266
|
+
$('#node-input-filename').typedInput('value', node.filename)
|
|
267
267
|
} else if (/^\${[^}]+}$/.test(node.filename)) { // was using an ${ENV_VAR}
|
|
268
|
-
node.filenameType =
|
|
268
|
+
node.filenameType = 'env'
|
|
269
269
|
node.filename = node.filename.replace(/\${([^}]+)}/g, function (match, name) {
|
|
270
|
-
return (name === undefined) ?
|
|
270
|
+
return (name === undefined) ? '' : name
|
|
271
271
|
})
|
|
272
|
-
$(
|
|
273
|
-
$(
|
|
272
|
+
$('#node-input-filename').typedInput('type', node.filenameType)
|
|
273
|
+
$('#node-input-filename').typedInput('value', node.filename)
|
|
274
274
|
} else { // was using a static filename - set typedInput type to str
|
|
275
|
-
node.filenameType =
|
|
276
|
-
$(
|
|
277
|
-
$(
|
|
275
|
+
node.filenameType = 'str'
|
|
276
|
+
$('#node-input-filename').typedInput('type', node.filenameType)
|
|
277
|
+
$('#node-input-filename').typedInput('value', node.filename)
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
encodings.forEach(function (item) {
|
|
281
281
|
if (Array.isArray(item)) {
|
|
282
|
-
const group = $(
|
|
282
|
+
const group = $('<optgroup/>', {
|
|
283
283
|
label: node._(item[0])
|
|
284
284
|
}).appendTo(encSel)
|
|
285
285
|
for (let i = 1; i < item.length; i++) {
|
|
286
286
|
const enc = item[i]
|
|
287
|
-
$(
|
|
287
|
+
$('<option/>', {
|
|
288
288
|
value: enc,
|
|
289
289
|
label: enc
|
|
290
290
|
}).text(enc).appendTo(group)
|
|
291
291
|
}
|
|
292
292
|
} else {
|
|
293
|
-
$(
|
|
293
|
+
$('<option/>', {
|
|
294
294
|
value: item,
|
|
295
295
|
label: item
|
|
296
296
|
}).text(item).appendTo(encSel)
|
|
297
297
|
}
|
|
298
298
|
})
|
|
299
299
|
encSel.val(node.encoding)
|
|
300
|
-
$(
|
|
301
|
-
if (this.value ===
|
|
302
|
-
$(
|
|
303
|
-
$(
|
|
300
|
+
$('#node-input-overwriteFile').on('change', function () {
|
|
301
|
+
if (this.value === 'delete') {
|
|
302
|
+
$('.form-row-file-write-options').hide()
|
|
303
|
+
$('.form-row-file-encoding').hide()
|
|
304
304
|
} else {
|
|
305
|
-
$(
|
|
306
|
-
$(
|
|
305
|
+
$('.form-row-file-write-options').show()
|
|
306
|
+
$('.form-row-file-encoding').show()
|
|
307
307
|
}
|
|
308
308
|
})
|
|
309
309
|
}
|
|
@@ -312,106 +312,106 @@
|
|
|
312
312
|
RED.nodes.registerType('file in', {
|
|
313
313
|
category: 'storage',
|
|
314
314
|
defaults: {
|
|
315
|
-
name: { value:
|
|
316
|
-
filename: { value:
|
|
317
|
-
filenameType: { value:
|
|
318
|
-
format: { value:
|
|
315
|
+
name: { value: '' },
|
|
316
|
+
filename: { value: '' },
|
|
317
|
+
filenameType: { value: 'str' },
|
|
318
|
+
format: { value: 'utf8' },
|
|
319
319
|
chunk: { value: false },
|
|
320
320
|
sendError: { value: false },
|
|
321
|
-
encoding: { value:
|
|
321
|
+
encoding: { value: 'none' },
|
|
322
322
|
allProps: { value: false }
|
|
323
323
|
},
|
|
324
|
-
color:
|
|
324
|
+
color: 'BurlyWood',
|
|
325
325
|
inputs: 1,
|
|
326
326
|
outputs: 1,
|
|
327
327
|
outputLabels: function (i) {
|
|
328
328
|
let l
|
|
329
|
-
if (this.format ===
|
|
330
|
-
l =
|
|
331
|
-
} else if (this.format ===
|
|
332
|
-
l =
|
|
333
|
-
} else if (this.format ===
|
|
334
|
-
l =
|
|
329
|
+
if (this.format === 'utf8') {
|
|
330
|
+
l = 'file.label.utf8String'
|
|
331
|
+
} else if (this.format === 'lines') {
|
|
332
|
+
l = 'file.label.utf8String_plural'
|
|
333
|
+
} else if (this.format === 'stream') {
|
|
334
|
+
l = 'file.label.binaryBuffer_plural'
|
|
335
335
|
} else {
|
|
336
|
-
l =
|
|
336
|
+
l = 'file.label.binaryBuffer'
|
|
337
337
|
}
|
|
338
338
|
return this._(l)
|
|
339
339
|
},
|
|
340
|
-
icon:
|
|
340
|
+
icon: 'file-in.svg',
|
|
341
341
|
label: function () {
|
|
342
342
|
let fn = this.filename
|
|
343
|
-
if (this.filenameType
|
|
344
|
-
if (this.filenameType ===
|
|
345
|
-
return this.name || fn || this._(
|
|
343
|
+
if (this.filenameType !== 'str' && this.filenameType !== 'env') { fn = '' }
|
|
344
|
+
if (this.filenameType === 'env') { fn = 'env.' + fn }
|
|
345
|
+
return this.name || fn || this._('file.label.read')
|
|
346
346
|
},
|
|
347
|
-
paletteLabel: RED._(
|
|
347
|
+
paletteLabel: RED._('node-red:file.label.read'),
|
|
348
348
|
labelStyle: function () {
|
|
349
|
-
return this.name ?
|
|
349
|
+
return this.name ? 'node_label_italic' : ''
|
|
350
350
|
},
|
|
351
351
|
oneditprepare: function () {
|
|
352
352
|
const node = this
|
|
353
|
-
const encSel = $(
|
|
354
|
-
const label = node._(
|
|
355
|
-
$(
|
|
356
|
-
value:
|
|
353
|
+
const encSel = $('#node-input-encoding')
|
|
354
|
+
const label = node._('file.encoding.none')
|
|
355
|
+
$('<option/>', {
|
|
356
|
+
value: 'none',
|
|
357
357
|
label
|
|
358
358
|
}).text(label).appendTo(encSel)
|
|
359
|
-
$(
|
|
360
|
-
default:
|
|
361
|
-
types: [{ label: RED._(
|
|
362
|
-
typeField: $(
|
|
359
|
+
$('#node-input-filename').typedInput({
|
|
360
|
+
default: 'str',
|
|
361
|
+
types: [{ label: RED._('node-red:file.label.path'), value: 'str', icon: '' }, 'msg', 'jsonata', 'env'],
|
|
362
|
+
typeField: $('#node-input-filenameType')
|
|
363
363
|
})
|
|
364
|
-
if (typeof node.filenameType
|
|
364
|
+
if (typeof node.filenameType === 'undefined') {
|
|
365
365
|
// existing node AND filenameType is not set - inplace (compatible) upgrade to new typedInput
|
|
366
|
-
if (node.filename
|
|
367
|
-
node.filename =
|
|
368
|
-
node.filenameType =
|
|
369
|
-
$(
|
|
370
|
-
$(
|
|
366
|
+
if (node.filename === '') { // was using empty value to denote msg.filename - set typedInput to match
|
|
367
|
+
node.filename = 'filename'
|
|
368
|
+
node.filenameType = 'msg'
|
|
369
|
+
$('#node-input-filename').typedInput('type', node.filenameType)
|
|
370
|
+
$('#node-input-filename').typedInput('value', node.filename)
|
|
371
371
|
} else if (/^\${[^}]+}$/.test(node.filename)) { // was using an ${ENV_VAR}
|
|
372
|
-
node.filenameType =
|
|
372
|
+
node.filenameType = 'env'
|
|
373
373
|
node.filename = node.filename.replace(/\${([^}]+)}/g, function (match, name) {
|
|
374
|
-
return (name === undefined) ?
|
|
374
|
+
return (name === undefined) ? '' : name
|
|
375
375
|
})
|
|
376
|
-
$(
|
|
377
|
-
$(
|
|
376
|
+
$('#node-input-filename').typedInput('type', node.filenameType)
|
|
377
|
+
$('#node-input-filename').typedInput('value', node.filename)
|
|
378
378
|
} else { // was using a static filename - set typedInput type to str
|
|
379
|
-
node.filenameType =
|
|
380
|
-
$(
|
|
381
|
-
$(
|
|
379
|
+
node.filenameType = 'str'
|
|
380
|
+
$('#node-input-filename').typedInput('type', node.filenameType)
|
|
381
|
+
$('#node-input-filename').typedInput('value', node.filename)
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
encodings.forEach(function (item) {
|
|
385
385
|
if (Array.isArray(item)) {
|
|
386
|
-
const group = $(
|
|
386
|
+
const group = $('<optgroup/>', {
|
|
387
387
|
label: node._(item[0])
|
|
388
388
|
}).appendTo(encSel)
|
|
389
389
|
for (let i = 1; i < item.length; i++) {
|
|
390
390
|
const enc = item[i]
|
|
391
|
-
$(
|
|
391
|
+
$('<option/>', {
|
|
392
392
|
value: enc,
|
|
393
393
|
label: enc
|
|
394
394
|
}).text(enc).appendTo(group)
|
|
395
395
|
}
|
|
396
396
|
} else {
|
|
397
|
-
$(
|
|
397
|
+
$('<option/>', {
|
|
398
398
|
value: item,
|
|
399
399
|
label: item
|
|
400
400
|
}).text(item).appendTo(encSel)
|
|
401
401
|
}
|
|
402
402
|
})
|
|
403
403
|
encSel.val(node.encoding)
|
|
404
|
-
$(
|
|
405
|
-
const format = $(
|
|
406
|
-
if ((format ===
|
|
407
|
-
$(
|
|
404
|
+
$('#node-input-format').on('change', function () {
|
|
405
|
+
const format = $('#node-input-format').val()
|
|
406
|
+
if ((format === 'utf8') || (format === 'lines')) {
|
|
407
|
+
$('#encoding-spec').show()
|
|
408
408
|
} else {
|
|
409
|
-
$(
|
|
409
|
+
$('#encoding-spec').hide()
|
|
410
410
|
}
|
|
411
|
-
if ((format ===
|
|
412
|
-
$(
|
|
411
|
+
if ((format === 'lines') || (format === 'stream')) {
|
|
412
|
+
$('#file-allprops').show()
|
|
413
413
|
} else {
|
|
414
|
-
$(
|
|
414
|
+
$('#file-allprops').hide()
|
|
415
415
|
}
|
|
416
416
|
})
|
|
417
417
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowfuse/nr-file-nodes",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10-c4a6014-202602031410.0",
|
|
4
4
|
"description": "Node-RED file nodes packaged for FlowFuse",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@eslint/js": "^9.39.2",
|
|
44
|
-
"@
|
|
44
|
+
"@flowfuse/file-server": "^2.26.2",
|
|
45
45
|
"eslint": "^9.39.2",
|
|
46
46
|
"eslint-plugin-html": "^8.1.3",
|
|
47
47
|
"eslint-plugin-no-only-tests": "^3.3.0",
|