@vitormnm/node-red-simple-opcua 1.4.3 → 1.6.2

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.
Files changed (34) hide show
  1. package/client/icons/opcua.svg +132 -132
  2. package/client/lib/opcua-client-browser.js +368 -330
  3. package/client/lib/opcua-client-method-service.js +88 -88
  4. package/client/lib/opcua-client-read-service.js +27 -15
  5. package/client/lib/opcua-client-subscription-id-service.js +24 -24
  6. package/client/lib/opcua-client-subscription-service.js +175 -170
  7. package/client/lib/opcua-client-write-service.js +146 -146
  8. package/client/opcua-client-config.html +80 -80
  9. package/client/opcua-client-utils.js +217 -22
  10. package/client/opcua-client.html +140 -140
  11. package/client/view/opcua-client.js +1144 -1140
  12. package/examples/flows_simple_opc.json +1 -2851
  13. package/icons/opcua.svg +132 -132
  14. package/icons/opcua2.svg +132 -132
  15. package/package.json +3 -3
  16. package/server/icons/opcua.svg +132 -132
  17. package/server/lib/opcua-address-space-alarm.js +341 -341
  18. package/server/lib/opcua-address-space-builder.js +1797 -1485
  19. package/server/lib/opcua-config.js +800 -546
  20. package/server/lib/opcua-constants.js +120 -109
  21. package/server/lib/opcua-server-events-child.js +139 -139
  22. package/server/lib/opcua-server-methods.js +2 -0
  23. package/server/lib/opcua-server-runtime-child.js +874 -819
  24. package/server/lib/opcua-server-runtime.js +385 -311
  25. package/server/lib/opcua-server-status-child.js +187 -187
  26. package/server/lib/server-node-utils.js +16 -16
  27. package/server/opcua-server-io.html +346 -346
  28. package/server/opcua-server-io.js +497 -496
  29. package/server/opcua-server-registry.js +270 -270
  30. package/server/opcua-server.css +265 -265
  31. package/server/opcua-server.html +158 -1643
  32. package/server/opcua-server.js +24 -13
  33. package/server/view/opcua-server.css +496 -0
  34. package/server/view/opcua-server.js +1585 -0
@@ -8,12 +8,6 @@ module.exports = function (RED) {
8
8
  const { fork } = require("child_process");
9
9
  const path = require("path");
10
10
 
11
-
12
-
13
-
14
-
15
-
16
-
17
11
  function OpcUaServerNode(config) {
18
12
  RED.nodes.createNode(this, config);
19
13
  const node = this;
@@ -39,14 +33,11 @@ module.exports = function (RED) {
39
33
  "settings": settings
40
34
  }
41
35
 
42
- // const child = fork(workerPath, [JSON.stringify(fork_parameter)], {
43
- // cwd: __dirname, // opcional, mas recomendado
44
- // });
45
36
 
46
37
  const child = fork(workerPath, {
47
38
  cwd: __dirname, // opcional, mas recomendado
48
39
  });
49
-
40
+ child.setMaxListeners(0);
50
41
 
51
42
 
52
43
  registry.registerChild(node.serverName, child);
@@ -73,9 +64,13 @@ module.exports = function (RED) {
73
64
 
74
65
  child.on("message", (msg) => {
75
66
  if (msg.nodeId == node.id) {
76
- if (msg.type === "status") {
77
67
 
78
- node.status(msg.data); // aqui sim usa o node
68
+ if (msg.type === "send") {
69
+ node.send(msg.data);
70
+ }
71
+
72
+ if (msg.type === "status") {
73
+ node.status(msg.data);
79
74
  }
80
75
 
81
76
  if (msg.type === "log") {
@@ -138,10 +133,26 @@ module.exports = function (RED) {
138
133
  node.status({ fill: "red", shape: "ring", text: message });
139
134
  }
140
135
 
136
+
137
+
138
+ RED.httpAdmin.get("/opcua-server-resource/opcua-server.css", function (req, res) {
139
+ const cssPath = path.join(__dirname, "view", "opcua-server.css");
140
+ res.sendFile(cssPath);
141
+ });
142
+
143
+ RED.httpAdmin.get("/opcua-server-resource/opcua-server.js", function (req, res) {
144
+ const jsPath = path.join(__dirname, "view", "opcua-server.js");
145
+ res.sendFile(jsPath);
146
+ });
147
+
148
+
149
+
141
150
  RED.nodes.registerType("opc-ua-server", OpcUaServerNode, {
142
151
  credentials: {
143
152
  username: { type: "text" },
144
- password: { type: "password" }
153
+ password: { type: "password" },
154
+ users: { type: "text" },
155
+ groups: { type: "text" }
145
156
  }
146
157
  });
147
158
  };
@@ -0,0 +1,496 @@
1
+ body.opcua-tree-modal-open {
2
+ overflow: hidden;
3
+ }
4
+
5
+ .opcua-tree-editor {
6
+ width: 100%;
7
+ min-height: 180px;
8
+ border: 1px solid var(--red-ui-form-input-border-color, #d9d9d9);
9
+ background: var(--red-ui-form-input-background, #fff);
10
+ border-radius: 4px;
11
+ overflow: auto;
12
+ }
13
+
14
+ .opcua-tree-layout {
15
+ display: grid;
16
+ grid-template-columns: minmax(360px, 1.1fr) minmax(280px, 0.9fr);
17
+ gap: 12px;
18
+ height: 100%;
19
+ min-height: 0;
20
+ }
21
+
22
+ .opcua-tree-left,
23
+ .opcua-tree-right {
24
+ min-height: 0;
25
+ display: flex;
26
+ flex-direction: column;
27
+ }
28
+
29
+ .opcua-tree-details-title {
30
+ font-size: 12px;
31
+ text-transform: uppercase;
32
+ color: var(--red-ui-primary-text-color, #666);
33
+ margin-bottom: 6px;
34
+ font-weight: 600;
35
+ letter-spacing: 0.03em;
36
+ }
37
+
38
+ .opcua-tree-details {
39
+ border: 1px solid var(--red-ui-form-input-border-color, #d9d9d9);
40
+ border-radius: 4px;
41
+ background: var(--red-ui-form-input-background, #fff);
42
+ padding: 8px;
43
+ overflow: auto;
44
+ flex: 1 1 auto;
45
+ }
46
+
47
+ .opcua-tree-details .form-row {
48
+ display: flex;
49
+ align-items: center;
50
+ gap: 8px;
51
+ }
52
+
53
+ .opcua-tree-details .form-row label {
54
+ width: 140px;
55
+ min-width: 140px;
56
+ margin: 0;
57
+ overflow: hidden;
58
+ text-overflow: ellipsis;
59
+ white-space: nowrap;
60
+ }
61
+
62
+ .opcua-tree-details .form-row input,
63
+ .opcua-tree-details .form-row select,
64
+ .opcua-tree-details .form-row textarea {
65
+ flex: 1 1 auto;
66
+ width: auto;
67
+ min-width: 0;
68
+ }
69
+
70
+ .opcua-nodeid-field {
71
+ display: flex;
72
+ align-items: center;
73
+ gap: 8px;
74
+ flex: 1 1 auto;
75
+ min-width: 0;
76
+ }
77
+
78
+ .opcua-nodeid-prefix {
79
+ flex: 0 0 auto;
80
+ color: var(--red-ui-primary-text-color, #666);
81
+ white-space: nowrap;
82
+ font-family: monospace;
83
+ }
84
+
85
+ .opcua-nodeid-field input {
86
+ flex: 1 1 auto;
87
+ min-width: 0;
88
+ font-family: monospace;
89
+ }
90
+
91
+ .opcua-tree-breadcrumbs {
92
+ margin-bottom: 8px;
93
+ min-height: 24px;
94
+ padding: 3px 6px;
95
+ border: 1px solid var(--red-ui-form-input-border-color, #d9d9d9);
96
+ border-radius: 4px;
97
+ font-size: 12px;
98
+ line-height: 18px;
99
+ background: var(--red-ui-secondary-background, #fafafa);
100
+ color: var(--red-ui-primary-text-color, #666);
101
+ overflow: hidden;
102
+ white-space: nowrap;
103
+ text-overflow: ellipsis;
104
+ }
105
+
106
+ .opcua-tree-row {
107
+ display: flex;
108
+ align-items: center;
109
+ gap: 5px;
110
+ min-height: 24px;
111
+ padding: 2px 6px;
112
+ font-size: 12px;
113
+ cursor: pointer;
114
+ border-bottom: 1px solid transparent;
115
+ }
116
+
117
+ .opcua-tree-row:hover {
118
+ background: var(--red-ui-list-item-background-hover, #f3f7fd);
119
+ }
120
+
121
+ .opcua-tree-row.is-selected {
122
+ background: var(--red-ui-list-item-background-selected, #d9ecff);
123
+ color: var(--red-ui-list-item-color-selected, inherit);
124
+ }
125
+
126
+ .opcua-tree-indent {
127
+ flex: 0 0 auto;
128
+ width: 14px;
129
+ }
130
+
131
+ .opcua-tree-twisty {
132
+ width: 16px;
133
+ text-align: center;
134
+ color: #777;
135
+ flex: 0 0 16px;
136
+ }
137
+
138
+ .opcua-tree-icon {
139
+ width: 14px;
140
+ text-align: center;
141
+ color: #777;
142
+ flex: 0 0 14px;
143
+ }
144
+
145
+ .opcua-tree-label {
146
+ flex: 1 1 auto;
147
+ overflow: hidden;
148
+ text-overflow: ellipsis;
149
+ white-space: nowrap;
150
+ }
151
+
152
+ .opcua-tree-type {
153
+ color: #777;
154
+ font-size: 11px;
155
+ flex: 0 0 auto;
156
+ }
157
+
158
+ .opcua-tree-context-menu {
159
+ position: fixed;
160
+ z-index: 2100;
161
+ min-width: 140px;
162
+ border: 1px solid var(--red-ui-form-input-border-color, #d9d9d9);
163
+ border-radius: 4px;
164
+ background: var(--red-ui-form-input-background, #fff);
165
+ box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
166
+ overflow: hidden;
167
+ }
168
+
169
+ .opcua-tree-context-menu a {
170
+ display: block;
171
+ padding: 6px 8px;
172
+ color: inherit;
173
+ text-decoration: none;
174
+ font-size: 12px;
175
+ }
176
+
177
+ .opcua-tree-context-menu a:hover {
178
+ background: var(--red-ui-list-item-background-hover, #f3f7fd);
179
+ }
180
+
181
+ .opcua-tree-modal {
182
+ position: fixed;
183
+ inset: 0;
184
+ z-index: 2000;
185
+ background: rgba(0, 0, 0, 0.45);
186
+ padding: 24px;
187
+ box-sizing: border-box;
188
+ }
189
+
190
+ .opcua-tree-modal__dialog {
191
+ display: flex;
192
+ flex-direction: column;
193
+ width: 100%;
194
+ height: 100%;
195
+ background: #f3f3f3;
196
+ border-radius: 8px;
197
+ overflow: hidden;
198
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
199
+ }
200
+
201
+ .opcua-tree-modal__header,
202
+ .opcua-tree-modal__toolbar {
203
+ display: flex;
204
+ align-items: center;
205
+ flex-wrap: wrap;
206
+ gap: 10px;
207
+ padding: 14px 18px;
208
+ background: #fff;
209
+ border-bottom: 1px solid #d9d9d9;
210
+ }
211
+
212
+ .opcua-tree-modal__title {
213
+ font-size: 18px;
214
+ font-weight: 600;
215
+ color: #333;
216
+ }
217
+
218
+ .opcua-tree-modal__header .editor-button-small {
219
+ margin-left: auto;
220
+ }
221
+
222
+ .opcua-tree-modal__body {
223
+ flex: 1 1 auto;
224
+ overflow: auto;
225
+ padding: 18px;
226
+ }
227
+
228
+ .opcua-tree-search {
229
+ display: flex;
230
+ align-items: center;
231
+ gap: 8px;
232
+ min-width: 280px;
233
+ margin-left: auto;
234
+ padding: 6px 10px;
235
+ border: 1px solid #d9d9d9;
236
+ border-radius: 6px;
237
+ background: #fafafa;
238
+ }
239
+
240
+ .opcua-tree-search input {
241
+ flex: 1 1 auto;
242
+ min-width: 120px;
243
+ border: 0;
244
+ outline: 0;
245
+ background: transparent;
246
+ box-shadow: none;
247
+ margin: 0;
248
+ }
249
+
250
+ .opcua-tree-search-results {
251
+ margin-bottom: 12px;
252
+ }
253
+
254
+ .opcua-tree-search-meta {
255
+ margin-bottom: 10px;
256
+ color: #666;
257
+ font-size: 12px;
258
+ }
259
+
260
+ .opcua-tree-search-result {
261
+ margin-bottom: 8px;
262
+ }
263
+
264
+ .opcua-tree-search-path {
265
+ margin-bottom: 4px;
266
+ color: #666;
267
+ font-size: 12px;
268
+ font-family: Consolas, monospace;
269
+ }
270
+
271
+ .opcua-tree-group,
272
+ .opcua-tree-node {
273
+ border: 1px solid #d9d9d9;
274
+ border-radius: 4px;
275
+ background: #fff;
276
+ margin-bottom: 8px;
277
+ }
278
+
279
+ .opcua-tree-node[data-depth="1"],
280
+ .opcua-tree-group[data-depth="1"] {
281
+ margin-left: 2px;
282
+ }
283
+
284
+ .opcua-tree-node[data-depth="2"],
285
+ .opcua-tree-group[data-depth="2"] {
286
+ margin-left: 2px;
287
+ }
288
+
289
+ .opcua-tree-node[data-depth="3"],
290
+ .opcua-tree-group[data-depth="3"] {
291
+ margin-left: 2px;
292
+ }
293
+
294
+ .opcua-tree-node[data-depth="4"],
295
+ .opcua-tree-group[data-depth="4"] {
296
+ margin-left: 2px;
297
+ }
298
+
299
+ .opcua-tree-header {
300
+ display: flex;
301
+ align-items: center;
302
+ flex-wrap: wrap;
303
+ gap: 4px;
304
+ padding: 4px 5px;
305
+ background: #f8f8f8;
306
+ }
307
+
308
+ .opcua-tree-body {
309
+ padding: 5px;
310
+ border-top: 1px solid #ededed;
311
+ }
312
+
313
+ .opcua-tree-toggle {
314
+ width: 24px;
315
+ height: 24px;
316
+ border: 0;
317
+ padding: 0;
318
+ background: transparent;
319
+ color: #666;
320
+ cursor: pointer;
321
+ flex: 0 0 auto;
322
+ }
323
+
324
+ .opcua-tree-title {
325
+ min-width: 100px;
326
+ font-weight: 600;
327
+ color: #444;
328
+ }
329
+
330
+ .opcua-tree-summary {
331
+ color: #777;
332
+ font-size: 12px;
333
+ white-space: nowrap;
334
+ }
335
+
336
+ .opcua-tree-input {
337
+ flex: 1 1 auto;
338
+ min-width: 220px;
339
+ }
340
+
341
+ .opcua-tree-actions {
342
+ margin-left: auto;
343
+ display: flex;
344
+ gap: 6px;
345
+ align-items: center;
346
+ flex-wrap: wrap;
347
+ }
348
+
349
+ .opcua-tree-empty {
350
+ padding: 14px;
351
+ border: 1px dashed #d9d9d9;
352
+ border-radius: 4px;
353
+ background: #fafafa;
354
+ color: #777;
355
+ text-align: center;
356
+ }
357
+
358
+ .opcua-tree-grid {
359
+ display: grid;
360
+ grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
361
+ gap: 12px;
362
+ }
363
+
364
+ .opcua-tree-grid .form-row {
365
+ margin-bottom: 0;
366
+ }
367
+
368
+ .opcua-tree-grid .form-row label {
369
+ width: 100px !important;
370
+ flex: 0 0 100px;
371
+ }
372
+
373
+ .opcua-tree-grid .form-row input,
374
+ .opcua-tree-grid .form-row select,
375
+ .opcua-tree-grid .form-row textarea {
376
+ width: auto;
377
+ flex: 1 1 auto;
378
+ min-width: 0;
379
+ }
380
+
381
+ .opcua-tree-form-row {
382
+ display: flex;
383
+ align-items: center;
384
+ gap: 8px;
385
+ }
386
+
387
+ .opcua-tree-form-row--full {
388
+ grid-column: 1 / -1;
389
+ }
390
+
391
+ .opcua-tree-divider {
392
+ grid-column: 1 / -1;
393
+ border-top: 1px solid #e3e3e3;
394
+ margin: 2px 0;
395
+ }
396
+
397
+ .opcua-tree-section-title {
398
+ grid-column: 1 / -1;
399
+ font-size: 12px;
400
+ font-weight: 700;
401
+ text-transform: uppercase;
402
+ letter-spacing: 0.04em;
403
+ color: #666;
404
+ margin-top: 2px;
405
+ }
406
+
407
+
408
+
409
+ .opcua-auth-layout {
410
+ display: grid;
411
+ grid-template-columns: minmax(260px, 0.8fr) minmax(420px, 1.2fr);
412
+ gap: 14px;
413
+ min-height: 100%;
414
+ }
415
+
416
+ .opcua-auth-panel {
417
+ min-height: 0;
418
+ display: flex;
419
+ flex-direction: column;
420
+ }
421
+
422
+ .opcua-auth-list {
423
+ border: 1px solid var(--red-ui-form-input-border-color, #d9d9d9);
424
+ border-radius: 4px;
425
+ background: var(--red-ui-form-input-background, #fff);
426
+ padding: 10px;
427
+ min-height: 180px;
428
+ overflow: auto;
429
+ }
430
+
431
+ .opcua-auth-card {
432
+ border: 1px solid #e3e3e3;
433
+ border-radius: 4px;
434
+ padding: 10px;
435
+ margin-bottom: 10px;
436
+ background: #fff;
437
+ }
438
+
439
+ .opcua-auth-card:last-child {
440
+ margin-bottom: 0;
441
+ }
442
+
443
+ .opcua-auth-card .form-row {
444
+ margin-bottom: 8px;
445
+ }
446
+
447
+ .opcua-auth-card .form-row:last-child {
448
+ margin-bottom: 0;
449
+ }
450
+
451
+ .opcua-auth-card label {
452
+ width: 90px;
453
+ }
454
+
455
+ .opcua-auth-card input,
456
+ .opcua-auth-card select {
457
+ width: calc(100% - 100px);
458
+ }
459
+
460
+ .opcua-auth-card .red-ui-typedInput-container {
461
+ width: calc(100% - 100px) !important;
462
+ }
463
+
464
+ @media (max-width: 900px) {
465
+ .opcua-tree-modal {
466
+ padding: 10px;
467
+ }
468
+
469
+ .opcua-tree-search {
470
+ min-width: 100%;
471
+ margin-left: 0;
472
+ }
473
+
474
+ .opcua-tree-layout {
475
+ grid-template-columns: 1fr;
476
+ }
477
+
478
+ .opcua-auth-layout {
479
+ grid-template-columns: 1fr;
480
+ }
481
+
482
+ .opcua-tree-header {
483
+ align-items: flex-start;
484
+ }
485
+
486
+ .opcua-tree-title,
487
+ .opcua-tree-summary,
488
+ .opcua-tree-input,
489
+ .opcua-tree-actions {
490
+ width: 100%;
491
+ }
492
+
493
+ .opcua-tree-actions {
494
+ margin-left: 0;
495
+ }
496
+ }