@theotherwillembotha/node-red-plugincore 0.0.52 → 0.0.54

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 (40) hide show
  1. package/README.md +110 -0
  2. package/build/GenerateNodes.js +1 -0
  3. package/build/core/NodeConstructor.d.ts +1 -0
  4. package/build/core/NodeConstructor.d.ts.map +1 -1
  5. package/build/core/NodeConstructor.js +52 -14
  6. package/build/core/NodeGenerator.js +12 -10
  7. package/build/core/logger/node/ConsoleLoggerConfigNode.js +1 -0
  8. package/build/core/logger/node/LokiLoggerConfigNode.js +1 -0
  9. package/build/core/logger/node/RestLoggerConfigNode.js +1 -0
  10. package/build/core/logger/service/LoggerService.js +11 -1
  11. package/build/core/metrics/node/CounterMetricConfigNode.js +2 -0
  12. package/build/core/metrics/node/GaugeMetricConfigNode.js +2 -0
  13. package/build/core/metrics/node/MetricsConfigNode.js +1 -0
  14. package/build/core/metrics/node/TimerMetricConfigNode.js +2 -0
  15. package/build/core/metrics/service/MetricsService.js +24 -10
  16. package/build/core/other/service/SettingsService.js +2 -0
  17. package/build/core/tagging/service/NodeTypeService.js +2 -1
  18. package/build/core/ui/template/ScriptEditorTemplate.d.ts +5 -0
  19. package/build/core/ui/template/ScriptEditorTemplate.d.ts.map +1 -0
  20. package/build/core/ui/template/ScriptEditorTemplate.html +50 -0
  21. package/build/core/ui/template/ScriptEditorTemplate.js +11 -0
  22. package/build/core/webhook/node/WebhookServerConfigNode.js +1 -0
  23. package/build/core/webhook/service/ReverseProxyTypeService.js +2 -0
  24. package/build/core/webhook/service/WebhookServerService.js +4 -1
  25. package/build/index.d.ts +1 -0
  26. package/build/index.d.ts.map +1 -1
  27. package/build/index.js +1 -0
  28. package/build/resources/editorLanguageExtension.d.ts +1 -0
  29. package/build/resources/editorLanguageExtension.d.ts.map +1 -0
  30. package/build/resources/editorLanguageExtension.js +1190 -0
  31. package/package.json +4 -3
  32. package/resources/editorLanguageExtension.d.ts +1 -0
  33. package/resources/editorLanguageExtension.d.ts.map +1 -0
  34. package/resources/editorLanguageExtension.js +1190 -0
  35. package/src/GenerateNodes.ts +2 -1
  36. package/src/core/NodeConstructor.ts +4 -0
  37. package/src/core/ui/template/ScriptEditorTemplate.html +50 -0
  38. package/src/core/ui/template/ScriptEditorTemplate.ts +14 -0
  39. package/src/index.ts +1 -0
  40. package/src/resources/editorLanguageExtension.ts +1281 -0
package/README.md CHANGED
@@ -17,6 +17,8 @@ This framework is the foundation for a growing set of Node-RED plugins. The foll
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
19
  | [@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. |
20
+ | [@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. |
21
+ | [@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. |
20
22
 
21
23
  Additional plugins will be listed here as they are published.
22
24
 
@@ -179,6 +181,7 @@ Templates bundle reusable UI fragments that compose into any node's editor panel
179
181
  | `TimerMetricTemplate` | Timer config node reference |
180
182
  | `WebhookTemplate` | Webhook server reference, path, auth, and reverse proxy config |
181
183
  | `UIHelperTemplate` | Global `PluginCore.dialog()` and `PluginCore.table()` UI factories (see below) |
184
+ | `ScriptEditorTemplate` | Global `PluginCore.createScriptEditor()` factory for Monaco-based script editors (see below) |
182
185
  | `SettingsTemplate` | General settings section |
183
186
  | `BasicTemplate` | Base styles shared by all nodes |
184
187
 
@@ -265,6 +268,113 @@ $container.append($table);
265
268
  | `plugincore-status-enabled` | Green | Enabled / active state |
266
269
  | `plugincore-status-disabled` | Red | Disabled / inactive state |
267
270
 
271
+ #### `PluginCore.createScriptEditor(elementId, template, initialValue)`
272
+
273
+ Including `ScriptEditorTemplate` in a node's `templates` list injects a Monaco-based script editor factory into the Node-RED editor page. It wraps the async Monaco initialisation boilerplate into a single call and returns a `{ getValue(), dispose() }` handle.
274
+
275
+ ```javascript
276
+ // In onIncludeEditPrepare:
277
+ let scriptTemplate = `
278
+ interface Message { [key: string]: any; }
279
+ async function(msg: Message) {
280
+ \${script}
281
+ }
282
+ `;
283
+
284
+ node.scriptEditor = PluginCore.createScriptEditor(
285
+ 'node-input-script-editor', // DOM id of the container element
286
+ scriptTemplate, // TypeScript context template
287
+ node.script || 'return true;' // initial value
288
+ );
289
+
290
+ // In onIncludeEditSave:
291
+ node.script = node.scriptEditor.getValue();
292
+ delete node.scriptEditor;
293
+
294
+ // In IncludeEditCancel:
295
+ node.scriptEditor.dispose();
296
+ delete node.scriptEditor;
297
+ ```
298
+
299
+ The `template` string provides the TypeScript context that the Monaco language service uses for diagnostics, completions, and hover info. Use `\${script}` as the placeholder for the user's code. The user only sees their code — the surrounding context is invisible to them but informs type checking.
300
+
301
+ **Returns:** `{ getValue(): string, dispose(): void }`
302
+
303
+ ---
304
+
305
+ > **Note — Handlebars escaping in node HTML files**
306
+ >
307
+ > Node HTML files (`.html` template files) are processed by Handlebars during the build. This means any `{{ }}` syntax in the HTML — including in JavaScript comments or JSDoc — will be interpreted as a Handlebars expression and produce unexpected output or an error.
308
+ >
309
+ > Escape curly braces with a backslash wherever they appear literally in the file:
310
+ >
311
+ > ```javascript
312
+ > // Wrong — Handlebars will try to evaluate this:
313
+ > // @returns {{ getValue(): string }}
314
+ >
315
+ > // Correct — escaped so Handlebars passes it through:
316
+ > // @returns \{{ getValue(): string \}}
317
+ > ```
318
+ >
319
+ > This applies anywhere in the HTML file: `<script>` blocks, inline styles, markdown documentation sections, and comments.
320
+
321
+ ---
322
+
323
+ ### Node HTML file — template sections
324
+
325
+ 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.
326
+
327
+ ```html
328
+ <script type="text/javascript" template-section="onCompose"> ... </script>
329
+ <div template-section="onIncludeOnce"> ... </div>
330
+ <script type="text/javascript" template-section="onIncludeEditPrepare"> ... </script>
331
+ <script type="text/html" template-section="onIncludeEditForm"> ... </script>
332
+ <script type="text/javascript" template-section="onIncludeEditSave"> ... </script>
333
+ <script type="text/javascript" template-section="onIncludeEditCancel"> ... </script>
334
+ <script type="text/javascript" template-section="onIncludeEditDelete"> ... </script>
335
+ <script type="text/markdown" template-section="onIncludeDocumentation"> ... </script>
336
+ ```
337
+
338
+ #### Section reference
339
+
340
+ | Section | When it runs | Typical use |
341
+ |---------|-------------|-------------|
342
+ | `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. |
343
+ | `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>`. |
344
+ | `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. |
345
+ | `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. |
346
+ | `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. |
347
+ | `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. |
348
+ | `onIncludeEditDelete` | Runs when the node is **deleted** from the canvas | Release any persistent resources tied to this node instance. Rarely needed for most nodes. |
349
+ | `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. |
350
+
351
+ #### `onCompose` — NodeBuilder API
352
+
353
+ The `onCompose` script runs at build time with `node` bound to a `NodeBuilder` instance. The following methods are available:
354
+
355
+ | Method | Description |
356
+ |--------|-------------|
357
+ | `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. |
358
+ | `node.setLabel(fn)` | Set a function that returns the node's palette label at runtime. |
359
+ | `node.setPaletteLabel(label)` | Set the fixed palette label. |
360
+ | `node.setColor(color)` | Set the node's palette colour (hex string). |
361
+ | `node.setIcon(icon)` | Set the node's palette icon filename (relative to the plugin's `icons/` directory). |
362
+ | `node.setLabelStyle(style)` | Set the CSS class for the palette label (e.g. `node_label_white`). |
363
+ | `node.setInput(label)` | Add an input port with the given label. |
364
+ | `node.addOutputs(labels)` | Add one or more output ports. Pass a string array for multiple labelled outputs. |
365
+
366
+ #### Data flow through the edit lifecycle
367
+
368
+ ```
369
+ oneditprepare → [user edits] → oneditsave (Done clicked)
370
+ → oneditcancel (Cancel clicked)
371
+ → oneditdelete (node deleted)
372
+ ```
373
+
374
+ 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`.
375
+
376
+ ---
377
+
268
378
  ### Registering nodes for generation
269
379
 
270
380
  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`).
@@ -24,6 +24,7 @@ new index_js_1.NodeGenerator("./src/core/")
24
24
  .registerTemplate(index_js_1.TimerMetricTemplate)
25
25
  .registerTemplate(index_js_2.WebhookTemplate)
26
26
  .registerTemplate(index_js_1.UIHelperTemplate)
27
+ .registerTemplate(index_js_1.ScriptEditorTemplate)
27
28
  // nodes
28
29
  .registerNode(DelegatedConfigReferenceNode_js_1.DelegatedConfigReferenceNode)
29
30
  .registerNode(index_js_1.ConsoleLoggerConfigNode)
@@ -135,6 +135,7 @@ export type DefaultTemplateType = {
135
135
  required: boolean;
136
136
  minInstances?: number;
137
137
  maxInstances?: number;
138
+ validate?: Function;
138
139
  };
139
140
  export declare class NodeBuilder {
140
141
  private _name;
@@ -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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W;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"}
@@ -12,8 +12,11 @@ const js_beautify_1 = __importDefault(require("js-beautify"));
12
12
  const markdown_it_1 = __importDefault(require("markdown-it"));
13
13
  const handlebars_1 = __importDefault(require("handlebars"));
14
14
  class BaseNode {
15
+ _node;
15
16
  node() { return this._node; }
17
+ _config;
16
18
  config() { return this._config; }
19
+ _flow;
17
20
  flow() { return this._flow; }
18
21
  // THIS value is imported from NodeRed Node itself.
19
22
  id() { return this.config().id; }
@@ -48,10 +51,15 @@ class ConfigNode extends BaseNode {
48
51
  }
49
52
  exports.ConfigNode = ConfigNode;
50
53
  class NodeDescriptor {
54
+ _group;
55
+ _id;
56
+ _name;
57
+ _sourceFile;
58
+ _dependencies = [];
59
+ _templates = [];
60
+ _package;
61
+ _tags = [];
51
62
  constructor(group, id, name, sourceFile, pkg) {
52
- this._dependencies = [];
53
- this._templates = [];
54
- this._tags = [];
55
63
  this._group = group;
56
64
  this._id = id;
57
65
  this._name = name;
@@ -86,6 +94,10 @@ class NodeDescriptor {
86
94
  }
87
95
  exports.NodeDescriptor = NodeDescriptor;
88
96
  class TemplateDescriptor {
97
+ _name;
98
+ _dependencies;
99
+ _clazz;
100
+ _templateFile;
89
101
  constructor(name, clazz, templateFile, dependencies) {
90
102
  this._name = name;
91
103
  this._clazz = clazz;
@@ -107,6 +119,12 @@ class TemplateDescriptor {
107
119
  }
108
120
  exports.TemplateDescriptor = TemplateDescriptor;
109
121
  class ServiceDescriptor {
122
+ _id;
123
+ _name;
124
+ _type;
125
+ _sourceFile;
126
+ _clazz;
127
+ _dependencies;
110
128
  constructor(id, name, type, sourceFile, clazz, dependencies) {
111
129
  this._id = id;
112
130
  this._name = name;
@@ -138,6 +156,10 @@ exports.Template = Template;
138
156
  const POST_CONSTRUCT_KEY = Symbol('postConstructInitializers');
139
157
  // Builder class for post-construct decorators
140
158
  class PostConstructDecoratorBuilder {
159
+ decoratorName;
160
+ initLogic;
161
+ validator;
162
+ defaultConfig;
141
163
  constructor(decoratorName) {
142
164
  this.decoratorName = decoratorName;
143
165
  }
@@ -269,8 +291,11 @@ let runPostConstructInitializers = function (instance) {
269
291
  };
270
292
  // ************************************************
271
293
  class NodeManager {
294
+ static PLUGINID = "node-red-contrib-theotherwillembotha/services-plugin";
295
+ static _RED;
296
+ nodeTypeService;
297
+ typeBacklog = [];
272
298
  constructor(RED) {
273
- this.typeBacklog = [];
274
299
  NodeManager._RED = RED;
275
300
  let nodeTypeServiceListener = async (pluginID) => {
276
301
  if (pluginID === "@theotherwillembotha/nodetypeservice") {
@@ -362,8 +387,8 @@ class NodeManager {
362
387
  }
363
388
  }
364
389
  exports.NodeManager = NodeManager;
365
- NodeManager.PLUGINID = "node-red-contrib-theotherwillembotha/services-plugin";
366
390
  class BaseService {
391
+ _name;
367
392
  constructor(name) {
368
393
  this._name = name;
369
394
  }
@@ -416,16 +441,26 @@ let beautifyOptions = {
416
441
  },
417
442
  };
418
443
  class NodeBuilder {
444
+ // see https://nodered.org/docs/creating-nodes/node-html#node-definition
445
+ _name;
446
+ _category;
447
+ _defaults = {};
448
+ _credentials; // TODO
449
+ _color;
450
+ _label;
451
+ _icon;
452
+ _paletteLabel;
453
+ _labelStyle;
454
+ _inputs;
455
+ _outputs = [];
456
+ _onIncludeOnce = [];
457
+ _onIncludeEditPrepare = [];
458
+ _onIncludeEditSave = [];
459
+ _onIncludeEditCancel = [];
460
+ _onIncludeEditDelete = [];
461
+ _onIncludeEditForm = [];
462
+ _onIncludeDocumentation = [];
419
463
  constructor(name, category) {
420
- this._defaults = {};
421
- this._outputs = [];
422
- this._onIncludeOnce = [];
423
- this._onIncludeEditPrepare = [];
424
- this._onIncludeEditSave = [];
425
- this._onIncludeEditCancel = [];
426
- this._onIncludeEditDelete = [];
427
- this._onIncludeEditForm = [];
428
- this._onIncludeDocumentation = [];
429
464
  this._name = name;
430
465
  this._category = category;
431
466
  }
@@ -529,6 +564,9 @@ class NodeBuilder {
529
564
  case "string": {
530
565
  return `'${value}'`;
531
566
  }
567
+ case "function": {
568
+ return value.toString();
569
+ }
532
570
  case "object": {
533
571
  if (Array.isArray(value)) {
534
572
  return `[${value.map(t => this.serializeProperty(t)).join(", ")}]`;
@@ -38,10 +38,18 @@ 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 headerWidth = 50;
42
+ static 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
+ `;
48
+ _rootFolder;
49
+ _nodes = {};
50
+ _services = [];
51
+ _templates = [];
41
52
  constructor(rootFolder) {
42
- this._nodes = {};
43
- this._services = [];
44
- this._templates = [];
45
53
  this._rootFolder = rootFolder;
46
54
  }
47
55
  addDependency(dependency) {
@@ -240,13 +248,6 @@ module.exports = function (RED) {
240
248
  }
241
249
  }
242
250
  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
251
  class TypeUtility {
251
252
  constructor() { }
252
253
  static getPrototypes(t) {
@@ -264,6 +265,7 @@ class TypeUtility {
264
265
  }
265
266
  }
266
267
  class Hierarchy {
268
+ types;
267
269
  constructor(types) {
268
270
  this.types = types;
269
271
  }
@@ -16,6 +16,7 @@ const NodeGenerator_1 = require("../../NodeGenerator");
16
16
  const LoggerServiceTypes_1 = require("../service/LoggerServiceTypes");
17
17
  const NodeDescriptionDecorator_1 = require("../../tagging/NodeDescriptionDecorator");
18
18
  let ConsoleLoggerConfigNode = class ConsoleLoggerConfigNode extends NodeConstructor_1.ConfigNode {
19
+ _logger;
19
20
  constructor(node, config) {
20
21
  super(node, config);
21
22
  let _this = this;
@@ -16,6 +16,7 @@ const NodeGenerator_1 = require("../../NodeGenerator");
16
16
  const LoggerServiceTypes_1 = require("../service/LoggerServiceTypes");
17
17
  const NodeDescriptionDecorator_1 = require("../../tagging/NodeDescriptionDecorator");
18
18
  let LokiLoggerConfigNode = class LokiLoggerConfigNode extends NodeConstructor_1.ConfigNode {
19
+ _logger;
19
20
  constructor(node, config) {
20
21
  super(node, config);
21
22
  let _this = this;
@@ -16,6 +16,7 @@ const NodeGenerator_1 = require("../../NodeGenerator");
16
16
  const LoggerServiceTypes_1 = require("../service/LoggerServiceTypes");
17
17
  const NodeDescriptionDecorator_1 = require("../../tagging/NodeDescriptionDecorator");
18
18
  let RestLoggerConfigNode = class RestLoggerConfigNode extends NodeConstructor_1.ConfigNode {
19
+ _logger;
19
20
  constructor(node, config) {
20
21
  super(node, config);
21
22
  let _this = this;
@@ -19,6 +19,10 @@ handlebars_1.default.registerHelper('json', function (context) {
19
19
  return JSON.stringify(context);
20
20
  });
21
21
  class LogImplementation {
22
+ root;
23
+ config;
24
+ template;
25
+ tagMap;
22
26
  constructor(root, config) {
23
27
  this.root = root;
24
28
  this.config = config;
@@ -49,6 +53,8 @@ class LogImplementation {
49
53
  }
50
54
  exports.LogImplementation = LogImplementation;
51
55
  class NewLogger {
56
+ _config;
57
+ template;
52
58
  constructor(config) {
53
59
  this._config = config;
54
60
  this.template = handlebars_1.default.compile(config.template);
@@ -86,6 +92,7 @@ class ConsoleLogger extends NewLogger {
86
92
  }
87
93
  }
88
94
  class LokiLogger extends NewLogger {
95
+ logger;
89
96
  constructor(config) {
90
97
  super(config);
91
98
  let transportConfig = {
@@ -115,6 +122,7 @@ class LokiLogger extends NewLogger {
115
122
  }
116
123
  }
117
124
  class RestLogger extends NewLogger {
125
+ logger;
118
126
  constructor(config) {
119
127
  super(config);
120
128
  let hosturl = (0, whatwg_url_1.parseURL)(config.url);
@@ -171,6 +179,9 @@ let LoggerTypes = {
171
179
  rest: RestLogger
172
180
  };
173
181
  class LoggerService extends NodeConstructor_1.BaseService {
182
+ static instanceID;
183
+ static loggers = {};
184
+ red;
174
185
  constructor() {
175
186
  super("logger");
176
187
  }
@@ -200,4 +211,3 @@ class LoggerService extends NodeConstructor_1.BaseService {
200
211
  }
201
212
  }
202
213
  exports.LoggerService = LoggerService;
203
- LoggerService.loggers = {};
@@ -17,6 +17,8 @@ const MetricsConfigNode_1 = require("./MetricsConfigNode");
17
17
  const MetricsTemplate_1 = require("../template/MetricsTemplate");
18
18
  const NodeDescriptionDecorator_1 = require("../../tagging/NodeDescriptionDecorator");
19
19
  let CounterMetricConfigNode = class CounterMetricConfigNode extends NodeConstructor_1.ConfigNode {
20
+ _metrics;
21
+ _counter;
20
22
  constructor(node, config) {
21
23
  super(node, config);
22
24
  let _this = this;
@@ -17,6 +17,8 @@ const MetricsConfigNode_1 = require("./MetricsConfigNode");
17
17
  const MetricsTemplate_1 = require("../template/MetricsTemplate");
18
18
  const NodeDescriptionDecorator_1 = require("../../tagging/NodeDescriptionDecorator");
19
19
  let GaugeMetricConfigNode = class GaugeMetricConfigNode extends NodeConstructor_1.ConfigNode {
20
+ _metrics;
21
+ _gauge;
20
22
  constructor(node, config) {
21
23
  super(node, config);
22
24
  let _this = this;
@@ -19,6 +19,7 @@ const WebhookServerService_1 = require("../../webhook/service/WebhookServerServi
19
19
  const prom_client_1 = require("prom-client");
20
20
  const NodeDescriptionDecorator_1 = require("../../tagging/NodeDescriptionDecorator");
21
21
  let MetricsConfigNode = class MetricsConfigNode extends NodeConstructor_1.ConfigNode {
22
+ _metrics;
22
23
  constructor(node, config) {
23
24
  super(node, config);
24
25
  let _this = this;
@@ -18,6 +18,8 @@ const MetricsTemplate_1 = require("../template/MetricsTemplate");
18
18
  const MetricsDecorator_1 = require("../MetricsDecorator");
19
19
  const NodeDescriptionDecorator_1 = require("../../tagging/NodeDescriptionDecorator");
20
20
  let TimerMetricConfigNode = class TimerMetricConfigNode extends NodeConstructor_1.ConfigNode {
21
+ _metrics;
22
+ _timer;
21
23
  constructor(node, config) {
22
24
  super(node, config);
23
25
  let _this = this;
@@ -41,6 +41,8 @@ const NodeConstructor_1 = require("../../NodeConstructor");
41
41
  const prom_client_1 = __importStar(require("prom-client"));
42
42
  const deep_equal_1 = __importDefault(require("deep-equal"));
43
43
  class Metric {
44
+ _config;
45
+ _labels;
44
46
  constructor(config) {
45
47
  this._config = config;
46
48
  this._labels = { flow: config.node.flow, type: config.node.type, name: config.node.name, id: config.node.id, metric: config.metricname };
@@ -54,9 +56,11 @@ class Metric {
54
56
  }
55
57
  exports.Metric = Metric;
56
58
  class CounterMetric extends Metric {
59
+ counter;
60
+ internalCounter;
61
+ subscribers = {};
57
62
  constructor(id, config, registry) {
58
63
  super(config);
59
- this.subscribers = {};
60
64
  this.counter = new prom_client_1.Counter({
61
65
  name: id,
62
66
  help: (config.metricdescription) ? config.metricdescription : config.metricname,
@@ -86,10 +90,11 @@ class CounterMetric extends Metric {
86
90
  }
87
91
  exports.CounterMetric = CounterMetric;
88
92
  class GaugeMetric extends Metric {
93
+ collector = 0;
94
+ gauge;
95
+ subscribers = {};
89
96
  constructor(id, config, registry) {
90
97
  super(config);
91
- this.collector = 0;
92
- this.subscribers = {};
93
98
  let _this = this;
94
99
  this.gauge = new prom_client_1.default.Gauge({
95
100
  name: id,
@@ -137,9 +142,10 @@ var BucketType;
137
142
  BucketType["exponential"] = "exponential";
138
143
  })(BucketType || (exports.BucketType = BucketType = {}));
139
144
  class HistogramMetric extends Metric {
145
+ histogram;
146
+ subscribers = {};
140
147
  constructor(id, config, registry) {
141
148
  super(config);
142
- this.subscribers = {};
143
149
  // Build the Histogram Config.
144
150
  let histogramConfig = {
145
151
  name: id,
@@ -182,6 +188,8 @@ class HistogramMetric extends Metric {
182
188
  }
183
189
  exports.HistogramMetric = HistogramMetric;
184
190
  class HistogramState {
191
+ _values;
192
+ _average;
185
193
  constructor(values) {
186
194
  this._values = values;
187
195
  let sum = this._values.find(value => value.metricName?.endsWith("_sum"))?.value;
@@ -193,6 +201,8 @@ class HistogramState {
193
201
  }
194
202
  }
195
203
  class SummaryState {
204
+ _values;
205
+ _average;
196
206
  constructor(values) {
197
207
  this._values = values;
198
208
  let sum = this._values.find(value => value.metricName?.endsWith("_sum"))?.value;
@@ -209,9 +219,10 @@ var PercentileType;
209
219
  PercentileType["manual"] = "manual";
210
220
  })(PercentileType || (exports.PercentileType = PercentileType = {}));
211
221
  class SummaryMetric extends Metric {
222
+ summary;
223
+ subscribers = {};
212
224
  constructor(id, config, registry) {
213
225
  super(config);
214
- this.subscribers = {};
215
226
  let summaryConfig = {
216
227
  name: id,
217
228
  help: (config.metricdescription) ? config.metricdescription : config.metricname,
@@ -246,11 +257,13 @@ class SummaryMetric extends Metric {
246
257
  }
247
258
  exports.SummaryMetric = SummaryMetric;
248
259
  class MetricsContainer {
260
+ _config;
261
+ _registry;
262
+ counters = {};
263
+ histograms = {};
264
+ gauges = {};
265
+ summaries = {};
249
266
  constructor(config) {
250
- this.counters = {};
251
- this.histograms = {};
252
- this.gauges = {};
253
- this.summaries = {};
254
267
  this._config = config;
255
268
  // create a registry with the config.
256
269
  this._registry = new prom_client_1.default.Registry();
@@ -328,6 +341,8 @@ class MetricsContainer {
328
341
  }
329
342
  exports.MetricsContainer = MetricsContainer;
330
343
  class MetricsService extends NodeConstructor_1.BaseService {
344
+ static metrics = {};
345
+ red;
331
346
  constructor() {
332
347
  super("MetricsService");
333
348
  }
@@ -365,7 +380,6 @@ class MetricsService extends NodeConstructor_1.BaseService {
365
380
  }
366
381
  }
367
382
  exports.MetricsService = MetricsService;
368
- MetricsService.metrics = {};
369
383
  /*
370
384
  Quick explanation of how this is supposed to work:
371
385
 
@@ -38,6 +38,8 @@ class SettingsService extends NodeConstructor_1.BaseService {
38
38
  }
39
39
  exports.SettingsService = SettingsService;
40
40
  class Settings {
41
+ _settings;
42
+ _config;
41
43
  constructor(settings, config) {
42
44
  this._settings = settings;
43
45
  this._config = config;
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NodeTypeService = void 0;
4
4
  const NodeConstructor_1 = require("../../NodeConstructor");
5
5
  class NodeTypeService extends NodeConstructor_1.BaseService {
6
+ red;
7
+ nodeTypes = {};
6
8
  constructor() {
7
9
  super("nodetypes");
8
- this.nodeTypes = {};
9
10
  }
10
11
  init(red) {
11
12
  this.red = red;
@@ -0,0 +1,5 @@
1
+ import { Template, TemplateDescriptor } from "../../NodeConstructor";
2
+ export declare class ScriptEditorTemplate extends Template {
3
+ static getTemplateDescriptor(): TemplateDescriptor;
4
+ }
5
+ //# sourceMappingURL=ScriptEditorTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScriptEditorTemplate.d.ts","sourceRoot":"","sources":["../../../../src/core/ui/template/ScriptEditorTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAGpE,qBAAa,oBAAqB,SAAQ,QAAQ;WAEhC,qBAAqB,IAAI,kBAAkB;CAQ5D"}
@@ -0,0 +1,50 @@
1
+
2
+ <div template-section="onIncludeOnce">
3
+
4
+ <script src="resources/@theotherwillembotha/node-red-plugincore/editorLanguageExtension.js"></script>
5
+
6
+ <script type="text/javascript">
7
+
8
+ window.PluginCore = window.PluginCore || {};
9
+
10
+ /**
11
+ * PluginCore.createScriptEditor(elementId, template, initialValue)
12
+ *
13
+ * Creates a Monaco editor instance with TypeScript-aware diagnostics,
14
+ * completions, and hover info scoped to the provided type template.
15
+ *
16
+ * @param {string} elementId - DOM id of the container element.
17
+ * @param {string} template - TypeScript template string. Use `${script}`
18
+ * as the placeholder for the user's code.
19
+ * @param {string} initialValue - The starting content of the editor.
20
+ * @returns \{{ getValue(): string, dispose(): void \}}
21
+ */
22
+ PluginCore.createScriptEditor = function(elementId, template, initialValue) {
23
+ var editorInstance = null;
24
+ var currentValue = initialValue || '';
25
+
26
+ ScriptEditorLanguageManager.createLanguage(monaco, template).then(function(language) {
27
+ editorInstance = monaco.editor.create(document.getElementById(elementId), {
28
+ value: currentValue,
29
+ language: language.getName(),
30
+ automaticLayout: true,
31
+ wordBasedSuggestions: 'currentDocument',
32
+ });
33
+ });
34
+
35
+ return {
36
+ getValue: function() {
37
+ return editorInstance ? editorInstance.getValue() : currentValue;
38
+ },
39
+ dispose: function() {
40
+ if (editorInstance) {
41
+ editorInstance.dispose();
42
+ editorInstance = null;
43
+ }
44
+ }
45
+ };
46
+ };
47
+
48
+ </script>
49
+
50
+ </div>