@theotherwillembotha/node-red-plugincore 0.0.53 → 0.0.55
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/README.md +62 -8
- package/build/GenerateNodes.js +0 -1
- package/build/Nodes.html +0 -141
- package/build/Nodes.js +0 -2
- package/build/Plugins.js +2 -2
- package/build/core/NodeConstructor.d.ts +1 -0
- package/build/core/NodeConstructor.d.ts.map +1 -1
- package/build/core/NodeConstructor.js +5 -2
- package/build/core/NodeGenerator.js +9 -9
- package/build/core/logger/LoggerDecorator.d.ts.map +1 -1
- package/build/core/logger/LoggerDecorator.js +34 -38
- package/build/core/logger/node/ConsoleLoggerConfigNode.d.ts +11 -7
- package/build/core/logger/node/ConsoleLoggerConfigNode.d.ts.map +1 -1
- package/build/core/logger/node/ConsoleLoggerConfigNode.js +24 -9
- package/build/core/logger/node/RestLoggerConfigNode.d.ts +22 -6
- package/build/core/logger/node/RestLoggerConfigNode.d.ts.map +1 -1
- package/build/core/logger/node/RestLoggerConfigNode.js +93 -22
- package/build/core/logger/service/LoggerService.d.ts +59 -68
- package/build/core/logger/service/LoggerService.d.ts.map +1 -1
- package/build/core/logger/service/LoggerService.js +76 -155
- package/build/core/logger/template/LoggerTemplate.d.ts +9 -1
- package/build/core/logger/template/LoggerTemplate.d.ts.map +1 -1
- package/build/core/metrics/service/MetricsService.js +1 -1
- package/build/core/webhook/WebhookDecorator.d.ts.map +1 -1
- package/build/core/webhook/WebhookDecorator.js +4 -4
- package/build/core/webhook/service/ReverseProxyTypeService.d.ts +0 -2
- package/build/core/webhook/service/ReverseProxyTypeService.d.ts.map +1 -1
- package/build/core/webhook/service/ReverseProxyTypeService.js +1 -4
- package/build/core/webhook/service/WebhookServerService.d.ts +1 -1
- package/build/core/webhook/service/WebhookServerService.d.ts.map +1 -1
- package/build/core/webhook/service/WebhookServerService.js +6 -6
- package/build/core/webhook/template/WebhookTemplate.d.ts +1 -1
- package/build/core/webhook/template/WebhookTemplate.d.ts.map +1 -1
- package/build/index.d.ts +1 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -2
- package/build/resources/editorLanguageExtension.js +1 -1
- package/package.json +5 -3
- package/resources/editorLanguageExtension.js +1 -1
- package/src/GenerateNodes.ts +2 -2
- package/src/core/NodeConstructor.ts +5 -1
- package/src/core/NodeGenerator.ts +2 -2
- package/src/core/logger/LoggerDecorator.ts +56 -53
- package/src/core/logger/node/ConsoleLoggerConfigNode.ts +39 -14
- package/src/core/logger/node/RestLoggerConfigNode.ts +128 -25
- package/src/core/logger/service/LoggerService.ts +103 -239
- package/src/core/logger/template/LoggerTemplate.ts +11 -1
- package/src/core/webhook/WebhookDecorator.ts +1 -3
- package/src/core/webhook/service/ReverseProxyTypeService.ts +0 -4
- package/src/core/webhook/service/WebhookServerService.ts +1 -1
- package/src/core/webhook/template/WebhookTemplate.ts +1 -1
- package/src/index.ts +2 -2
- package/build/core/logger/node/LokiLoggerConfigNode.d.ts +0 -20
- package/build/core/logger/node/LokiLoggerConfigNode.d.ts.map +0 -1
- package/build/core/logger/node/LokiLoggerConfigNode.html +0 -117
- package/build/core/logger/node/LokiLoggerConfigNode.js +0 -52
- package/build/core/logger/service/LoggerServiceTypes.d.ts +0 -24
- package/build/core/logger/service/LoggerServiceTypes.d.ts.map +0 -1
- package/build/core/logger/service/LoggerServiceTypes.js +0 -30
- package/documentation/LokiLoggerConfigNode.png +0 -0
- package/src/core/logger/node/LokiLoggerConfigNode.html +0 -117
- package/src/core/logger/node/LokiLoggerConfigNode.ts +0 -58
- package/src/core/logger/service/LoggerServiceTypes.ts +0 -26
package/README.md
CHANGED
|
@@ -16,7 +16,11 @@ This framework is the foundation for a growing set of Node-RED plugins. The foll
|
|
|
16
16
|
| Plugin | Description |
|
|
17
17
|
|--------|-------------|
|
|
18
18
|
| [@theotherwillembotha/node-red-telemetry](https://github.com/theotherwillembotha/nodered_telemetry) | Ready-to-use flow nodes for structured logging and Prometheus metrics — Logger, Counter, Gauge, and Timer nodes that attach to the config nodes provided by this package. |
|
|
19
|
+
| [@theotherwillembotha/node-red-loki](https://github.com/theotherwillembotha/nodered_loki) | Grafana Loki logger config node. Extends the logging infrastructure provided by this package with a Loki transport, enabling log delivery directly to a Loki instance from any node built with the `@Logger` decorator. |
|
|
19
20
|
| [@theotherwillembotha/node-red-nginxproxymanager](https://github.com/theotherwillembotha/nodered_nginxproxymanager) | Node-RED nodes for managing Nginx Proxy Manager hosts directly from your flows. Includes a config node that registers as a reverse proxy provider, an Update Host node for creating and updating proxy entries, and a Get Hosts node for retrieving the current host list. |
|
|
21
|
+
| [@theotherwillembotha/node-red-circuitbreaker](https://github.com/theotherwillembotha/nodered_circuitbreaker) | Circuit Breaker nodes for building resilient flows. Detects faults in external integrations using configurable fault and trip functions, routes messages based on breaker state, and supports event-driven recovery flows. |
|
|
22
|
+
| [@theotherwillembotha/node-red-temporal](https://github.com/theotherwillembotha/nodered_temporal) | Date/time transformation nodes powered by the TC39 Temporal API. Parse, convert, adjust, and format date/time values across timezones using named presets or Moment.js-style custom format strings. |
|
|
23
|
+
| [@theotherwillembotha/node-red-zookeeper](https://github.com/theotherwillembotha/nodered_zookeeper) | Apache ZooKeeper integration nodes. Subscribe to ZooKeeper node change events, read node values on demand, and write data to ZooKeeper nodes from your flows. |
|
|
20
24
|
|
|
21
25
|
Additional plugins will be listed here as they are published.
|
|
22
26
|
|
|
@@ -40,7 +44,7 @@ Config nodes are shared resources configured once and referenced across your flo
|
|
|
40
44
|
|
|
41
45
|
#### Logging
|
|
42
46
|
|
|
43
|
-
|
|
47
|
+
Two logger backends are built in. Additional backends are available as separate plugins (see the [plugin ecosystem](#plugin-ecosystem) table above). All expose the same interface and are interchangeable — any node built with the `@Logger` decorator can use any of them.
|
|
44
48
|
|
|
45
49
|
**Console Logger** — writes structured log output to stdout via Winston. Ideal for development and containerised deployments that forward stdout to a log aggregator.
|
|
46
50
|
|
|
@@ -50,11 +54,7 @@ Three logger backends are supported. All expose the same interface and are inter
|
|
|
50
54
|
|
|
51
55
|

|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-

|
|
56
|
-
|
|
57
|
-
All three loggers share a **Level** selector (debug, info, warn, error) and a **Template** field — a Handlebars template that controls the shape of each log entry. The default `message:{{msg}}` passes the raw message through; you can customise it to include only the fields you care about.
|
|
57
|
+
All loggers share a **Level** selector (debug, info, warn, error) and a **Template** field — a Handlebars template that controls the shape of each log entry. The default `message:{{msg}}` passes the raw message through; you can customise it to include only the fields you care about.
|
|
58
58
|
|
|
59
59
|
#### Metrics
|
|
60
60
|
|
|
@@ -318,6 +318,61 @@ The `template` string provides the TypeScript context that the Monaco language s
|
|
|
318
318
|
|
|
319
319
|
---
|
|
320
320
|
|
|
321
|
+
### Node HTML file — template sections
|
|
322
|
+
|
|
323
|
+
Each node's `.html` file is divided into named sections using the `template-section` attribute. The build pipeline reads these sections and assembles them into the correct slots in the generated Node-RED registration call. Sections from multiple templates (e.g. `LoggerTemplate`, `MetricsTemplate`) are merged automatically in the order they were registered.
|
|
324
|
+
|
|
325
|
+
```html
|
|
326
|
+
<script type="text/javascript" template-section="onCompose"> ... </script>
|
|
327
|
+
<div template-section="onIncludeOnce"> ... </div>
|
|
328
|
+
<script type="text/javascript" template-section="onIncludeEditPrepare"> ... </script>
|
|
329
|
+
<script type="text/html" template-section="onIncludeEditForm"> ... </script>
|
|
330
|
+
<script type="text/javascript" template-section="onIncludeEditSave"> ... </script>
|
|
331
|
+
<script type="text/javascript" template-section="onIncludeEditCancel"> ... </script>
|
|
332
|
+
<script type="text/javascript" template-section="onIncludeEditDelete"> ... </script>
|
|
333
|
+
<script type="text/markdown" template-section="onIncludeDocumentation"> ... </script>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
#### Section reference
|
|
337
|
+
|
|
338
|
+
| Section | When it runs | Typical use |
|
|
339
|
+
|---------|-------------|-------------|
|
|
340
|
+
| `onCompose` | At **build time**, inside a `NodeBuilder` context | Call `node.addDefault(...)`, `node.setLabel(...)`, `node.setColor(...)`, `node.setIcon(...)`, `node.addOutputs(...)`, etc. to configure the node definition that will be written into the generated `Nodes.js`. This section is **not** shipped to the browser. |
|
|
341
|
+
| `onIncludeOnce` | Injected into the browser **once** per page load | Global styles (`<style>`), shared helper functions, and cached resource fetches (e.g. timezone or format lists). Everything here is shared across all node instances of this type. Wrap scripts in `<script>` tags inside a `<div>`. |
|
|
342
|
+
| `onIncludeEditPrepare` | Runs when the **node editor dialog opens** (Node-RED `oneditprepare`) | Initialise `typedInput` widgets, bind event listeners, fetch async data, restore saved state. `this` refers to the node being edited — assign it to a local variable (e.g. `let node = this`) before any async code. |
|
|
343
|
+
| `onIncludeEditForm` | The **HTML form** rendered inside the editor dialog | `<div class="form-row">` blocks containing `<label>` and `<input>` elements. Use `id="node-input-<fieldName>"` for regular nodes or `id="node-config-input-<fieldName>"` for config nodes. Include hidden `<input type="hidden">` fields for `typedInput` type tracking. |
|
|
344
|
+
| `onIncludeEditSave` | Runs when the user clicks **Done** (Node-RED `oneditsave`) | Read widget values back into the node object before it is serialised. Most `typedInput` widgets save automatically via the `node-input-*` naming convention; use this section for anything that does not. |
|
|
345
|
+
| `onIncludeEditCancel` | Runs when the user clicks **Cancel** (Node-RED `oneditcancel`) | Clean up resources that were created in `onIncludeEditPrepare` — e.g. call `.dispose()` on Monaco editor instances to avoid memory leaks. |
|
|
346
|
+
| `onIncludeEditDelete` | Runs when the node is **deleted** from the canvas | Release any persistent resources tied to this node instance. Rarely needed for most nodes. |
|
|
347
|
+
| `onIncludeDocumentation` | Rendered in the Node-RED **help panel** (sidebar Info tab) | Markdown content describing the node's behaviour, fields, and examples. Supports standard GitHub-flavoured markdown including tables, code blocks, and blockquotes. |
|
|
348
|
+
|
|
349
|
+
#### `onCompose` — NodeBuilder API
|
|
350
|
+
|
|
351
|
+
The `onCompose` script runs at build time with `node` bound to a `NodeBuilder` instance. The following methods are available:
|
|
352
|
+
|
|
353
|
+
| Method | Description |
|
|
354
|
+
|--------|-------------|
|
|
355
|
+
| `node.addDefault(name, options)` | Register a config field. `options`: `{ value, required, validate? }`. The optional `validate` function is serialised as-is into the generated `defaults` block and runs in the browser editor. |
|
|
356
|
+
| `node.setLabel(fn)` | Set a function that returns the node's palette label at runtime. |
|
|
357
|
+
| `node.setPaletteLabel(label)` | Set the fixed palette label. |
|
|
358
|
+
| `node.setColor(color)` | Set the node's palette colour (hex string). |
|
|
359
|
+
| `node.setIcon(icon)` | Set the node's palette icon filename (relative to the plugin's `icons/` directory). |
|
|
360
|
+
| `node.setLabelStyle(style)` | Set the CSS class for the palette label (e.g. `node_label_white`). |
|
|
361
|
+
| `node.setInput(label)` | Add an input port with the given label. |
|
|
362
|
+
| `node.addOutputs(labels)` | Add one or more output ports. Pass a string array for multiple labelled outputs. |
|
|
363
|
+
|
|
364
|
+
#### Data flow through the edit lifecycle
|
|
365
|
+
|
|
366
|
+
```
|
|
367
|
+
oneditprepare → [user edits] → oneditsave (Done clicked)
|
|
368
|
+
→ oneditcancel (Cancel clicked)
|
|
369
|
+
→ oneditdelete (node deleted)
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Values flow through `node-input-<field>` (or `node-config-input-<field>`) named inputs. Node-RED automatically saves and restores these between sessions. Fields not following this convention must be manually read in `onIncludeEditSave` and written in `onIncludeEditPrepare`.
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
321
376
|
### Registering nodes for generation
|
|
322
377
|
|
|
323
378
|
Create a `GenerateNodes.ts` at the root of your `src/` directory. This is the composition root — register every service, template, and node, then call `.generate()` to emit the two Node-RED entry files (`Nodes.js` and `Plugins.js`).
|
|
@@ -326,7 +381,7 @@ Create a `GenerateNodes.ts` at the root of your `src/` directory. This is the co
|
|
|
326
381
|
import { NodeGenerator } from "@theotherwillembotha/node-red-plugincore";
|
|
327
382
|
import {
|
|
328
383
|
LoggerService, LoggerTemplate,
|
|
329
|
-
ConsoleLoggerConfigNode, RestLoggerConfigNode
|
|
384
|
+
ConsoleLoggerConfigNode, RestLoggerConfigNode
|
|
330
385
|
} from "@theotherwillembotha/node-red-plugincore";
|
|
331
386
|
import { MyNode } from "./nodes/MyNode";
|
|
332
387
|
|
|
@@ -335,7 +390,6 @@ new NodeGenerator("./src/")
|
|
|
335
390
|
.registerTemplate(LoggerTemplate)
|
|
336
391
|
.registerNode(ConsoleLoggerConfigNode)
|
|
337
392
|
.registerNode(RestLoggerConfigNode)
|
|
338
|
-
.registerNode(LokiLoggerConfigNode)
|
|
339
393
|
.registerNode(MyNode)
|
|
340
394
|
.generate("./build/Nodes", "./build/Plugins");
|
|
341
395
|
|
package/build/GenerateNodes.js
CHANGED
|
@@ -29,7 +29,6 @@ new index_js_1.NodeGenerator("./src/core/")
|
|
|
29
29
|
.registerNode(DelegatedConfigReferenceNode_js_1.DelegatedConfigReferenceNode)
|
|
30
30
|
.registerNode(index_js_1.ConsoleLoggerConfigNode)
|
|
31
31
|
.registerNode(index_js_1.RestLoggerConfigNode)
|
|
32
|
-
.registerNode(index_js_1.LokiLoggerConfigNode)
|
|
33
32
|
.registerNode(index_js_5.MetricsConfigNode)
|
|
34
33
|
.registerNode(index_js_5.CounterMetricConfigNode)
|
|
35
34
|
.registerNode(index_js_5.GaugeMetricConfigNode)
|
package/build/Nodes.html
CHANGED
|
@@ -366,147 +366,6 @@ Mustache/Handlebars templates build the message string POSTed to the endpoint.
|
|
|
366
366
|
- [Mustache — Wikipedia](https://en.wikipedia.org/wiki/Mustache_(template_system))
|
|
367
367
|
- [Mustache — Playground](https://jgonggrijp.gitlab.io/wontache/playground.html)
|
|
368
368
|
</script>
|
|
369
|
-
<script type="text/javascript">
|
|
370
|
-
RED.nodes.registerType('LokiLoggerConfigNode', {
|
|
371
|
-
category: 'config',
|
|
372
|
-
label: function() {
|
|
373
|
-
return this.name
|
|
374
|
-
},
|
|
375
|
-
paletteLabel: 'Loki Logger Config Node',
|
|
376
|
-
defaults: {
|
|
377
|
-
name: {
|
|
378
|
-
value: 'Logger Example',
|
|
379
|
-
required: true
|
|
380
|
-
},
|
|
381
|
-
template: {
|
|
382
|
-
value: 'message:{{msg}}',
|
|
383
|
-
required: true
|
|
384
|
-
},
|
|
385
|
-
level: {
|
|
386
|
-
value: 'info',
|
|
387
|
-
required: true
|
|
388
|
-
},
|
|
389
|
-
loki_host: {},
|
|
390
|
-
loki_tenantid: {},
|
|
391
|
-
loki_userid: {},
|
|
392
|
-
loki_authtoken: {},
|
|
393
|
-
},
|
|
394
|
-
oneditprepare: function() {
|
|
395
|
-
// **** LokiLoggerConfigNode **** //
|
|
396
|
-
{
|
|
397
|
-
let node = this;
|
|
398
|
-
let levelSelection = $("#node-config-input-level");
|
|
399
|
-
levelSelection.typedInput({
|
|
400
|
-
type: "level",
|
|
401
|
-
types: [{
|
|
402
|
-
value: "level",
|
|
403
|
-
options: [{
|
|
404
|
-
value: "DEBUG",
|
|
405
|
-
label: "debug"
|
|
406
|
-
}, {
|
|
407
|
-
value: "INFO",
|
|
408
|
-
label: "info"
|
|
409
|
-
}, {
|
|
410
|
-
value: "WARNING",
|
|
411
|
-
label: "warning"
|
|
412
|
-
}, {
|
|
413
|
-
value: "ERROR",
|
|
414
|
-
label: "error"
|
|
415
|
-
}, ]
|
|
416
|
-
}]
|
|
417
|
-
});
|
|
418
|
-
this.editor = RED.editor.createEditor({
|
|
419
|
-
id: 'node-config-input-templateEditor',
|
|
420
|
-
mode: 'ace/mode/handlebars',
|
|
421
|
-
value: this.template
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
},
|
|
425
|
-
oneditsave: function() {
|
|
426
|
-
// **** LokiLoggerConfigNode **** //
|
|
427
|
-
{
|
|
428
|
-
let node = this;
|
|
429
|
-
this.template = this.editor.getValue();
|
|
430
|
-
this.editor.destroy();
|
|
431
|
-
delete this.editor;
|
|
432
|
-
}
|
|
433
|
-
},
|
|
434
|
-
oneditcancel: function() {},
|
|
435
|
-
oneditdelete: function() {},
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
</script>
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
<script type="text/html" data-template-name='LokiLoggerConfigNode'>
|
|
442
|
-
<div id='section_LokiLoggerConfigNode'>
|
|
443
|
-
<div id="LoggerConfig">
|
|
444
|
-
<div class="form-row">
|
|
445
|
-
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
|
|
446
|
-
<input type="text" id="node-config-input-name" />
|
|
447
|
-
</div>
|
|
448
|
-
|
|
449
|
-
<div class="form-row">
|
|
450
|
-
<label class="towb_editorlabel" for="node-config-input-level"><i class="fa fa-signal"></i> Level</label>
|
|
451
|
-
<input type="text" id="node-config-input-level" />
|
|
452
|
-
</div>
|
|
453
|
-
|
|
454
|
-
<div class="form-row">
|
|
455
|
-
<label class="towb_editorlabel" for="node-config-input-loki_host"><i class="fa fa-server"></i> Host</label>
|
|
456
|
-
<input class="required" type="text" id="node-config-input-loki_host" />
|
|
457
|
-
</div>
|
|
458
|
-
<div class="form-row">
|
|
459
|
-
<label class="towb_editorlabel" for="node-config-input-loki_tenantid"><i class="fa fa-building-o"></i> Tenant ID</label>
|
|
460
|
-
<input class="" type="text" id="node-config-input-loki_tenantid" />
|
|
461
|
-
</div>
|
|
462
|
-
<div class="form-row">
|
|
463
|
-
<label class="towb_editorlabel" for="node-config-input-loki_userid"><i class="fa fa-user"></i> Username</label>
|
|
464
|
-
<input class="" type="text" id="node-config-input-loki_userid" />
|
|
465
|
-
</div>
|
|
466
|
-
<div class="form-row">
|
|
467
|
-
<label class="towb_editorlabel" for="node-config-input-loki_authtoken"><i class="fa fa-key"></i> Auth Token</label>
|
|
468
|
-
<input class="" type="password" id="node-config-input-loki_authtoken" />
|
|
469
|
-
</div>
|
|
470
|
-
|
|
471
|
-
<div class="form-row">
|
|
472
|
-
<label class="towb_editorlabel" for="node-config-input-templateEditor"><i class="fa fa-code"></i> Template</label>
|
|
473
|
-
<div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-config-input-templateEditor"></div>
|
|
474
|
-
</div>
|
|
475
|
-
</div>
|
|
476
|
-
|
|
477
|
-
</div>
|
|
478
|
-
</script>
|
|
479
|
-
|
|
480
|
-
<script type="text/markdown" data-help-name='LokiLoggerConfigNode'>
|
|
481
|
-
Pushes log messages to a Grafana Loki instance using the Loki HTTP API.
|
|
482
|
-
|
|
483
|
-
### Properties
|
|
484
|
-
: *name* (string) : A descriptive name for this logger configuration.
|
|
485
|
-
: *level* (level) : The minimum log level. Messages below this threshold are suppressed. Options: DEBUG, INFO, WARNING, ERROR.
|
|
486
|
-
: *host* (string) : The base URL of the Loki instance, including port (e.g. `http://localhost:3100`).
|
|
487
|
-
: *tenant ID* (string) : The tenant identifier for multi-tenant Loki deployments (`X-Scope-OrgID` header). Leave blank for single-tenant deployments.
|
|
488
|
-
: *username* (string) : Username for Loki authentication.
|
|
489
|
-
: *auth token* (string) : Authentication token or password for Loki.
|
|
490
|
-
: *template* (mustache) : A Mustache/Handlebars template that formats the log message body.
|
|
491
|
-
|
|
492
|
-
### Mustache Templating
|
|
493
|
-
Mustache/Handlebars templates build the message string pushed to Loki.
|
|
494
|
-
|
|
495
|
-
#### Provided Properties
|
|
496
|
-
: *msg* (object) : The Node-RED message object passed through the node.
|
|
497
|
-
: *currentTime* (string) : The current time in ISO 8601 format.
|
|
498
|
-
|
|
499
|
-
#### Helpers
|
|
500
|
-
: *json* (helper) : Serialises an object to a JSON string using `JSON.stringify`.
|
|
501
|
-
|
|
502
|
-
#### Examples
|
|
503
|
-
- `{{{json msg}}}` — serialises the full message object as JSON.
|
|
504
|
-
|
|
505
|
-
#### References
|
|
506
|
-
- [Grafana Loki — HTTP API](https://grafana.com/docs/loki/latest/reference/loki-http-api/)
|
|
507
|
-
- [Mustache — Wikipedia](https://en.wikipedia.org/wiki/Mustache_(template_system))
|
|
508
|
-
- [Mustache — Playground](https://jgonggrijp.gitlab.io/wontache/playground.html)
|
|
509
|
-
</script>
|
|
510
369
|
<!-- webhook -->
|
|
511
370
|
<script type="text/javascript">
|
|
512
371
|
// CSS
|
package/build/Nodes.js
CHANGED
|
@@ -12,7 +12,6 @@ const NodeManager = require("@theotherwillembotha/node-red-plugincore").NodeMana
|
|
|
12
12
|
const DelegatedConfigReferenceNode = require("@theotherwillembotha/node-red-plugincore").DelegatedConfigReferenceNode;
|
|
13
13
|
const ConsoleLoggerConfigNode = require("@theotherwillembotha/node-red-plugincore").ConsoleLoggerConfigNode;
|
|
14
14
|
const RestLoggerConfigNode = require("@theotherwillembotha/node-red-plugincore").RestLoggerConfigNode;
|
|
15
|
-
const LokiLoggerConfigNode = require("@theotherwillembotha/node-red-plugincore").LokiLoggerConfigNode;
|
|
16
15
|
const MetricsConfigNode = require("@theotherwillembotha/node-red-plugincore").MetricsConfigNode;
|
|
17
16
|
const CounterMetricConfigNode = require("@theotherwillembotha/node-red-plugincore").CounterMetricConfigNode;
|
|
18
17
|
const GaugeMetricConfigNode = require("@theotherwillembotha/node-red-plugincore").GaugeMetricConfigNode;
|
|
@@ -23,7 +22,6 @@ let manager = new NodeManager(RED);
|
|
|
23
22
|
manager.registerNodeType("DelegatedConfigReferenceNode", DelegatedConfigReferenceNode);
|
|
24
23
|
manager.registerNodeType("ConsoleLoggerConfigNode", ConsoleLoggerConfigNode);
|
|
25
24
|
manager.registerNodeType("RestLoggerConfigNode", RestLoggerConfigNode);
|
|
26
|
-
manager.registerNodeType("LokiLoggerConfigNode", LokiLoggerConfigNode);
|
|
27
25
|
manager.registerNodeType("MetricsConfigNode", MetricsConfigNode);
|
|
28
26
|
manager.registerNodeType("CounterMetricConfigNode", CounterMetricConfigNode);
|
|
29
27
|
manager.registerNodeType("GaugeMetricConfigNode", GaugeMetricConfigNode);
|
package/build/Plugins.js
CHANGED
|
@@ -46,7 +46,7 @@ module.exports = function (RED) {
|
|
|
46
46
|
RED.events.on('runtime-event', async (event) => {
|
|
47
47
|
// startup deployment.
|
|
48
48
|
if ("runtime-deploy" === event?.id && startupDeployment) {
|
|
49
|
-
console.log("STARTUP DEPLOYMENT");
|
|
49
|
+
//console.log("STARTUP DEPLOYMENT");
|
|
50
50
|
startupDeployment = false;
|
|
51
51
|
const flows = await runtime.flows.getFlows({});
|
|
52
52
|
await plugin.instance.onDeploy(flows);
|
|
@@ -54,7 +54,7 @@ module.exports = function (RED) {
|
|
|
54
54
|
|
|
55
55
|
// stopping flows on redeployment.
|
|
56
56
|
if ("runtime-state" === event?.id && event?.payload?.state === "stop" && event?.payload?.deploy) {
|
|
57
|
-
console.log("REDEPLOY!");
|
|
57
|
+
//console.log("REDEPLOY!");
|
|
58
58
|
const flows = await runtime.flows.getFlows({});
|
|
59
59
|
await plugin.instance.onDeploy(flows);
|
|
60
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeConstructor.d.ts","sourceRoot":"","sources":["../../src/core/NodeConstructor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAW,uBAAuB,EAAC,MAAM,UAAU,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEzE,OAAO,kBAAkB,CAAC;AAW1B,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAC,MAAM,CAAC;IACV,IAAI,EAAC,MAAM,CAAC;IACZ,IAAI,EAAC,MAAM,CAAC;CACf;AAED,8BAAsB,QAAQ,CAAC,MAAM,SAAS,cAAc;IAExD,OAAO,CAAC,KAAK,CAAM;IACZ,IAAI;IAEX,OAAO,CAAC,OAAO,CAAQ;IAChB,MAAM;IAEb,OAAO,CAAC,KAAK,CAAO;IACb,IAAI;IAGJ,EAAE;IACF,IAAI;IACJ,IAAI;IAEX,SAAS,aAAa,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM;IAWhD,SAAS,CAAC,MAAM;WAGF,iBAAiB,IAAG,cAAc;CAGnD;AAED,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CACvD;AAED,8BAAsB,UAAU,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C,MAAM,GAAE,WAAW;IAKlC,UAAU,CAAC,GAAG,OAAO,EAAC,MAAM,EAAE,GAAE,WAAW;IAK3C,WAAW,CAAC,QAAQ,EAAE;QAAE,QAAQ,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,cAAc,CAAC;KAAE,GAAG,WAAW;IAwBzF,cAAc,CAAC,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,GAAE,WAAW;IAKxD,qBAAqB,CAAC,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,GAAE,WAAW;IAK/D,kBAAkB,CAAC,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,GAAE,WAAW;IAK5D,oBAAoB,CAAC,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,GAAE,WAAW;IAK9D,oBAAoB,CAAC,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,GAAE,WAAW;IAK9D,kBAAkB,CAAC,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,GAAE,WAAW;IAK5D,uBAAuB,CAAC,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,GAAE,WAAW;IAKxE,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,2BAA2B;IAI5B,SAAS,IAAG,MAAM;IAiDlB,SAAS,IAAG,MAAM;IAQlB,kBAAkB,IAAG,MAAM;CASrC;AAiBD,QAAA,IAAI,SAAS,SAAiB,UAAU,WA4BvC,CAAA;AAED,OAAO,EACH,SAAS,EACZ,CAAA"}
|
|
@@ -269,6 +269,7 @@ let runPostConstructInitializers = function (instance) {
|
|
|
269
269
|
};
|
|
270
270
|
// ************************************************
|
|
271
271
|
class NodeManager {
|
|
272
|
+
static { this.PLUGINID = "node-red-contrib-theotherwillembotha/services-plugin"; }
|
|
272
273
|
constructor(RED) {
|
|
273
274
|
this.typeBacklog = [];
|
|
274
275
|
NodeManager._RED = RED;
|
|
@@ -317,7 +318,7 @@ class NodeManager {
|
|
|
317
318
|
console.error(`Type "${typeName}" has no associated type. Make sure that it was exported and included in the index.js file!`);
|
|
318
319
|
}
|
|
319
320
|
let nodeConstructor = function (config) {
|
|
320
|
-
console.log("constructing node", typeName);
|
|
321
|
+
//console.log("constructing node", typeName);
|
|
321
322
|
try {
|
|
322
323
|
// instantiate the node.
|
|
323
324
|
NodeManager.RED.nodes.createNode(this, config);
|
|
@@ -362,7 +363,6 @@ class NodeManager {
|
|
|
362
363
|
}
|
|
363
364
|
}
|
|
364
365
|
exports.NodeManager = NodeManager;
|
|
365
|
-
NodeManager.PLUGINID = "node-red-contrib-theotherwillembotha/services-plugin";
|
|
366
366
|
class BaseService {
|
|
367
367
|
constructor(name) {
|
|
368
368
|
this._name = name;
|
|
@@ -529,6 +529,9 @@ class NodeBuilder {
|
|
|
529
529
|
case "string": {
|
|
530
530
|
return `'${value}'`;
|
|
531
531
|
}
|
|
532
|
+
case "function": {
|
|
533
|
+
return value.toString();
|
|
534
|
+
}
|
|
532
535
|
case "object": {
|
|
533
536
|
if (Array.isArray(value)) {
|
|
534
537
|
return `[${value.map(t => this.serializeProperty(t)).join(", ")}]`;
|
|
@@ -38,6 +38,13 @@ const fs = __importStar(require("fs"));
|
|
|
38
38
|
const NodeConstructor_1 = require("./NodeConstructor");
|
|
39
39
|
const templatePropertyKeys = ["onIncludeOnce", "onIncludeDefaults", "onIncludeEditPrepare", "onIncludeEditPrepare", "onIncludeEditSave", "onIncludeEditForm"];
|
|
40
40
|
class NodeGenerator {
|
|
41
|
+
static { this.headerWidth = 50; }
|
|
42
|
+
static { this.warning = `
|
|
43
|
+
This file was automatically generated using the NODERED Core utility.
|
|
44
|
+
Any modifications to his file will be overwritten the next time the code is regenerated.
|
|
45
|
+
|
|
46
|
+
You have been warned.
|
|
47
|
+
`; }
|
|
41
48
|
constructor(rootFolder) {
|
|
42
49
|
this._nodes = {};
|
|
43
50
|
this._services = [];
|
|
@@ -200,7 +207,7 @@ module.exports = function (RED) {
|
|
|
200
207
|
RED.events.on('runtime-event', async (event) => {
|
|
201
208
|
// startup deployment.
|
|
202
209
|
if ("runtime-deploy" === event?.id && startupDeployment) {
|
|
203
|
-
console.log("STARTUP DEPLOYMENT");
|
|
210
|
+
//console.log("STARTUP DEPLOYMENT");
|
|
204
211
|
startupDeployment = false;
|
|
205
212
|
const flows = await runtime.flows.getFlows({});
|
|
206
213
|
await plugin.instance.onDeploy(flows);
|
|
@@ -208,7 +215,7 @@ module.exports = function (RED) {
|
|
|
208
215
|
|
|
209
216
|
// stopping flows on redeployment.
|
|
210
217
|
if ("runtime-state" === event?.id && event?.payload?.state === "stop" && event?.payload?.deploy) {
|
|
211
|
-
console.log("REDEPLOY!");
|
|
218
|
+
//console.log("REDEPLOY!");
|
|
212
219
|
const flows = await runtime.flows.getFlows({});
|
|
213
220
|
await plugin.instance.onDeploy(flows);
|
|
214
221
|
}
|
|
@@ -240,13 +247,6 @@ module.exports = function (RED) {
|
|
|
240
247
|
}
|
|
241
248
|
}
|
|
242
249
|
exports.NodeGenerator = NodeGenerator;
|
|
243
|
-
NodeGenerator.headerWidth = 50;
|
|
244
|
-
NodeGenerator.warning = `
|
|
245
|
-
This file was automatically generated using the NODERED Core utility.
|
|
246
|
-
Any modifications to his file will be overwritten the next time the code is regenerated.
|
|
247
|
-
|
|
248
|
-
You have been warned.
|
|
249
|
-
`;
|
|
250
250
|
class TypeUtility {
|
|
251
251
|
constructor() { }
|
|
252
252
|
static getPrototypes(t) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoggerDecorator.d.ts","sourceRoot":"","sources":["../../../src/core/logger/LoggerDecorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LoggerDecorator.d.ts","sourceRoot":"","sources":["../../../src/core/logger/LoggerDecorator.ts"],"names":[],"mappings":"AAIA,wBAAgB,MAAM,CAAC,KAAK,CAAC,EAAC,MAAM,GAAE,QAAQ,CAuG7C"}
|
|
@@ -2,41 +2,40 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Logger = Logger;
|
|
4
4
|
const NodeConstructor_1 = require("../NodeConstructor");
|
|
5
|
+
const LoggerService_1 = require("./service/LoggerService");
|
|
5
6
|
function Logger(debug) {
|
|
6
7
|
return function (target, propertyKey) {
|
|
7
8
|
// if the type is a string, then its probably defined in the local (core) module.
|
|
8
9
|
if (typeof propertyKey === "string") {
|
|
9
10
|
const valueSymbol = Symbol(`_${String(propertyKey)}_value`);
|
|
11
|
+
//console.log("BINDING:", "target", target, "propertyKey", propertyKey );
|
|
10
12
|
Object.defineProperty(target, propertyKey, {
|
|
11
13
|
get: function () {
|
|
14
|
+
//console.log("setting logger on node " + this.name() + " (localized)");
|
|
12
15
|
if (!this[valueSymbol]) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
try {
|
|
17
|
+
let node = this;
|
|
18
|
+
let config = node.config();
|
|
19
|
+
if (!config.logEnabled) {
|
|
20
|
+
return this[valueSymbol] = LoggerService_1.DoNothingAppender.get();
|
|
21
|
+
}
|
|
22
|
+
// get the logger config node.
|
|
23
|
+
let loggerConfigNode = NodeConstructor_1.NodeManager.RED.nodes.getNode(config.logger).node();
|
|
24
|
+
let loggerTemplateConfig = {
|
|
19
25
|
id: config.id,
|
|
20
26
|
flow: node.flow(),
|
|
21
27
|
type: node.type(),
|
|
22
28
|
name: node.name(),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
template: config.logTemplateOverride
|
|
29
|
+
level: loggerConfigNode.config().level,
|
|
30
|
+
template: (config.logTemplateOverrideEnabled) ? config.logTemplateOverride : loggerConfigNode.config().template,
|
|
26
31
|
};
|
|
27
32
|
// get a reference to the loggerService.
|
|
28
|
-
|
|
29
|
-
logger = NodeConstructor_1.NodeManager.RED.nodes.getNode(config.logger).node().registerLogger(registration);
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
console.log("failed getting logger ", config.logger, e);
|
|
33
|
-
logger = { log() { } };
|
|
34
|
-
}
|
|
33
|
+
return this[valueSymbol] = loggerConfigNode.registerTemplate(loggerTemplateConfig);
|
|
35
34
|
}
|
|
36
|
-
|
|
37
|
-
logger
|
|
35
|
+
catch (e) {
|
|
36
|
+
console.log(`failed getting logger "${this?.config()?.logger}"`, e);
|
|
37
|
+
return this[valueSymbol] = LoggerService_1.DoNothingAppender.get();
|
|
38
38
|
}
|
|
39
|
-
this[valueSymbol] = logger;
|
|
40
39
|
}
|
|
41
40
|
return this[valueSymbol];
|
|
42
41
|
},
|
|
@@ -47,39 +46,36 @@ function Logger(debug) {
|
|
|
47
46
|
}
|
|
48
47
|
else {
|
|
49
48
|
let property = propertyKey;
|
|
50
|
-
//property.addInitializer(() => {
|
|
51
49
|
property.addInitializer(function () {
|
|
52
50
|
let node = this;
|
|
53
51
|
const valueSymbol = Symbol(`_${String(property.name)}_value`);
|
|
52
|
+
//console.log("ADDING INITIALIZER:", "node", node, "property.name", property.name );
|
|
54
53
|
Object.defineProperty(node, property.name, {
|
|
55
54
|
get: function () {
|
|
55
|
+
//console.log("setting logger on node " + node.name()+ " (externalized)");
|
|
56
56
|
if (!this[valueSymbol]) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
try {
|
|
58
|
+
let config = node.config();
|
|
59
|
+
if (!config.logEnabled) {
|
|
60
|
+
return this[valueSymbol] = LoggerService_1.DoNothingAppender.get();
|
|
61
|
+
}
|
|
62
|
+
// get the logger config node.
|
|
63
|
+
let loggerConfigNode = NodeConstructor_1.NodeManager.RED.nodes.getNode(config.logger).node();
|
|
64
|
+
let loggerTemplateConfig = {
|
|
62
65
|
id: config.id,
|
|
63
66
|
flow: node.flow(),
|
|
64
67
|
type: node.type(),
|
|
65
68
|
name: node.name(),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
template: config.logTemplateOverride
|
|
69
|
+
level: loggerConfigNode?.config().level ?? 'info',
|
|
70
|
+
template: (config.logTemplateOverrideEnabled) ? config.logTemplateOverride : (loggerConfigNode?.config().template ?? 'message:{{msg}}'),
|
|
69
71
|
};
|
|
70
72
|
// get a reference to the loggerService.
|
|
71
|
-
|
|
72
|
-
logger = NodeConstructor_1.NodeManager.RED.nodes.getNode(config.logger).node().registerLogger(registration);
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
console.log("failed getting logger ", config.logger, e);
|
|
76
|
-
logger = { log() { } };
|
|
77
|
-
}
|
|
73
|
+
return this[valueSymbol] = loggerConfigNode.registerTemplate(loggerTemplateConfig);
|
|
78
74
|
}
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
catch (e) {
|
|
76
|
+
console.log("failed getting logger ", e);
|
|
77
|
+
return this[valueSymbol] = LoggerService_1.DoNothingAppender.get();
|
|
81
78
|
}
|
|
82
|
-
this[valueSymbol] = logger;
|
|
83
79
|
}
|
|
84
80
|
return this[valueSymbol];
|
|
85
81
|
},
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { Node } from "node-red";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
interface ConsoleLoggerConfigNodeConfig extends ConfigNodeConfig {
|
|
6
|
-
id: string;
|
|
2
|
+
import { LoggerConfigNodeConfig, BaseLoggerConfig, AbstractLogger, LoggerConfigNode, Log, Level } from "../service/LoggerService";
|
|
3
|
+
import { LoggerTemplateConfig } from "../template/LoggerTemplate";
|
|
4
|
+
interface ConsoleLoggerConfigNodeConfig extends LoggerConfigNodeConfig {
|
|
7
5
|
level: Level;
|
|
8
6
|
template: string;
|
|
9
7
|
}
|
|
10
|
-
export declare class ConsoleLoggerConfigNode extends
|
|
8
|
+
export declare class ConsoleLoggerConfigNode extends LoggerConfigNode<ConsoleLoggerConfigNodeConfig, ConsoleLogger> {
|
|
11
9
|
private _logger;
|
|
12
10
|
constructor(node: Node, config: ConsoleLoggerConfigNodeConfig);
|
|
13
|
-
|
|
11
|
+
protected logger(): ConsoleLogger;
|
|
12
|
+
}
|
|
13
|
+
export interface ConsoleLoggerConfig extends BaseLoggerConfig {
|
|
14
|
+
}
|
|
15
|
+
declare class ConsoleLogger extends AbstractLogger<ConsoleLoggerConfig> {
|
|
16
|
+
constructor(config: ConsoleLoggerConfig);
|
|
17
|
+
protected createLogger(config: LoggerTemplateConfig): Log;
|
|
14
18
|
}
|
|
15
19
|
export {};
|
|
16
20
|
//# sourceMappingURL=ConsoleLoggerConfigNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConsoleLoggerConfigNode.d.ts","sourceRoot":"","sources":["../../../../src/core/logger/node/ConsoleLoggerConfigNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,
|
|
1
|
+
{"version":3,"file":"ConsoleLoggerConfigNode.d.ts","sourceRoot":"","sources":["../../../../src/core/logger/node/ConsoleLoggerConfigNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAiB,sBAAsB,EAAE,gBAAgB,EAAE,cAAc,EAAU,gBAAgB,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAGxJ,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,UAAU,6BAA8B,SAAQ,sBAAsB;IAClE,KAAK,EAAC,KAAK,CAAC;IACZ,QAAQ,EAAC,MAAM,CAAC;CACnB;AAED,qBASa,uBAAwB,SAAQ,gBAAgB,CAAC,6BAA6B,EAAE,aAAa,CAAC;IAEvG,OAAO,CAAC,OAAO,CAAiB;gBAEpB,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,6BAA6B;IAgB7D,SAAS,CAAC,MAAM,IAAG,aAAa;CAGnC;AAED,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;CAE5D;AAED,cAAM,aAAc,SAAQ,cAAc,CAAC,mBAAmB,CAAC;gBAE/C,MAAM,EAAC,mBAAmB;IAItC,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,oBAAoB,GAAG,GAAG;CAG5D"}
|