@bonsae/nrg 0.15.1 → 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 +4 -10
- package/package.json +1 -1
- package/server/index.cjs +10 -4
- package/server/resources/nrg-client.js +561 -552
- package/test/index.js +1 -0
- package/types/server.d.ts +11 -6
- package/types/shims/form/components/node-red-editor-input.vue.d.ts +5 -1
- package/types/shims/form/components/node-red-json-schema-form.vue.d.ts +5 -1
package/README.md
CHANGED
|
@@ -11,16 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
# nrg
|
|
13
13
|
|
|
14
|
-
Build Node-RED nodes with Vue 3, TypeScript,
|
|
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
package/server/index.cjs
CHANGED
|
@@ -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
|
|
603
|
-
*
|
|
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)
|
|
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: [
|