@bonsae/nrg 0.15.0 → 0.16.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/README.md CHANGED
@@ -11,16 +11,8 @@
11
11
 
12
12
  # nrg
13
13
 
14
- Build Node-RED nodes with Vue 3, TypeScript, and JSON Schema validation.
14
+ Build Node-RED nodes with Vue 3, TypeScript, JSON Schema validations, Vite and Vistest.
15
15
 
16
- ## Install
17
-
18
- ```bash
19
- pnpm add @bonsae/nrg
20
- pnpm add -D vite
21
- ```
22
-
23
- > `vite` is a dev dependency because it is only needed at build time. Vue is included as a dependency of nrg and served automatically at runtime.
24
16
 
25
17
  ## Package Exports
26
18
 
@@ -37,9 +29,11 @@ pnpm add -D vite
37
29
  ```bash
38
30
  # In your Node-RED package project
39
31
  pnpm add @bonsae/nrg
40
- pnpm add -D vite
32
+ pnpm add -D vite vue
41
33
  ```
42
34
 
35
+ > `vite` ane `vue` are dev dependencies because they are only needed at build time. Vue is included as a dependency of nrg and served automatically at runtime.
36
+
43
37
  **vite.config.ts**
44
38
 
45
39
  ```typescript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonsae/nrg",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "NRG framework — build Node-RED nodes with Vue 3, TypeScript, and JSON Schema",
5
5
  "author": "Allan Oricil <allanoricil@duck.com>",
6
6
  "license": "MIT",
package/server/index.cjs CHANGED
@@ -199,7 +199,7 @@ function getCredentialsFromSchema(schema) {
199
199
  }
200
200
 
201
201
  // src/core/server/nodes/symbols.ts
202
- var WIRE_HANDLERS = Symbol("wireHandlers");
202
+ var WIRE_HANDLERS = Symbol.for("nrg.wireHandlers");
203
203
 
204
204
  // src/core/server/nodes/node.ts
205
205
  var cachedSettingsMap = /* @__PURE__ */ new WeakMap();
@@ -599,10 +599,14 @@ var IONode = class extends Node {
599
599
  }
600
600
  /**
601
601
  * Send a message to a specific output port by index or name.
602
- * Built-in ports: `"error"`, `"complete"`, `"status"` resolved automatically
603
- * based on the node's built-in port configuration.
602
+ * Built-in port `"status"` is resolved automatically based on the node's
603
+ * built-in port configuration.
604
604
  * Custom named ports are resolved from `outputsSchema` when it is a record.
605
605
  * Numeric indices refer to the base output ports (0-based).
606
+ *
607
+ * Note: `"error"` and `"complete"` ports are managed by the framework and
608
+ * cannot be sent to directly. Throw an error to trigger the error port,
609
+ * and the complete port is sent automatically on successful input processing.
606
610
  */
607
611
  sendToPort(port, msg) {
608
612
  this.#sendToPort(port, msg);
@@ -618,7 +622,7 @@ var IONode = class extends Node {
618
622
  portIndex = this.#getNamedPortIndex(port);
619
623
  if (portIndex === null) return;
620
624
  }
621
- const out = Array(this.totalOutputs).fill(null);
625
+ const out = new Array(this.totalOutputs);
622
626
  out[portIndex] = msg;
623
627
  this.node.send(out);
624
628
  }
@@ -648,9 +652,10 @@ var IONode = class extends Node {
648
652
  name: this.name
649
653
  };
650
654
  }
651
- status(status) {
655
+ status(status, data) {
652
656
  this.node.status(status);
653
657
  this.#sendToPort("status", {
658
+ ...data,
654
659
  status,
655
660
  source: this.#nodeSource()
656
661
  });
@@ -925,6 +930,7 @@ var ValidationError = class _ValidationError extends Error {
925
930
 
926
931
  // src/core/server/validation.ts
927
932
  function initValidator(RED) {
933
+ if (RED.validator) return;
928
934
  const nrg = {
929
935
  validator: new Validator({
930
936
  customKeywords: [