@bonsae/nrg-runtime 0.28.1 → 0.29.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/package.json +1 -1
- package/server/index.cjs +13 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonsae/nrg-runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "The runtime for Node-RED nodes built with @bonsae/nrg — node base classes, schemas, AJV validator, and the editor client. Carries no build tooling.",
|
|
5
5
|
"author": "Allan Oricil <allanoricil@duck.com>",
|
|
6
6
|
"license": "MIT",
|
package/server/index.cjs
CHANGED
|
@@ -48,7 +48,7 @@ __export(index_exports, {
|
|
|
48
48
|
});
|
|
49
49
|
module.exports = __toCommonJS(index_exports);
|
|
50
50
|
|
|
51
|
-
// src/core/errors.ts
|
|
51
|
+
// src/core/shared/errors.ts
|
|
52
52
|
var NrgError = class _NrgError extends Error {
|
|
53
53
|
constructor(message) {
|
|
54
54
|
super(message);
|
|
@@ -507,6 +507,8 @@ var IONode = class _IONode extends Node {
|
|
|
507
507
|
// validated, and results are frequently non-objects.
|
|
508
508
|
static outputsSchema;
|
|
509
509
|
static validateInput = false;
|
|
510
|
+
// A single boolean applies to every output port; a boolean[] sets the
|
|
511
|
+
// per-port default by base-output index (missing entries default to false).
|
|
510
512
|
static validateOutput = false;
|
|
511
513
|
static get inputs() {
|
|
512
514
|
return this.inputSchema ? 1 : 0;
|
|
@@ -683,12 +685,15 @@ var IONode = class _IONode extends Node {
|
|
|
683
685
|
/**
|
|
684
686
|
* Per-port output validation. A port validates when its flow-author flag
|
|
685
687
|
* (`config.validateOutputs[port]`) — or the node's static `validateOutput`
|
|
686
|
-
* fallback — is on and a schema exists for that port.
|
|
688
|
+
* fallback — is on and a schema exists for that port. The static fallback is
|
|
689
|
+
* a single boolean (all ports) or a boolean[] (per-port, by base index).
|
|
687
690
|
*/
|
|
688
691
|
#validatePort(value, port) {
|
|
689
692
|
const NodeClass = this.constructor;
|
|
693
|
+
const staticFlag = NodeClass.validateOutput;
|
|
694
|
+
const staticForPort = Array.isArray(staticFlag) ? staticFlag[port] ?? false : staticFlag;
|
|
690
695
|
const configured = this.config.validateOutputs?.[port];
|
|
691
|
-
if (!(configured ??
|
|
696
|
+
if (!(configured ?? staticForPort)) return;
|
|
692
697
|
const schema = this.#outputSchemaForPort(port);
|
|
693
698
|
if (!schema) return;
|
|
694
699
|
this.log("Validating output");
|
|
@@ -961,7 +966,7 @@ function defineConfigNode(def) {
|
|
|
961
966
|
return NodeClass;
|
|
962
967
|
}
|
|
963
968
|
|
|
964
|
-
// src/core/validator.ts
|
|
969
|
+
// src/core/shared/validator.ts
|
|
965
970
|
var import_ajv = __toESM(require("ajv"), 1);
|
|
966
971
|
var import_ajv_formats = __toESM(require("ajv-formats"), 1);
|
|
967
972
|
var import_ajv_errors = __toESM(require("ajv-errors"), 1);
|
|
@@ -1207,7 +1212,10 @@ function registerTypes(nodes) {
|
|
|
1207
1212
|
return fn;
|
|
1208
1213
|
}
|
|
1209
1214
|
|
|
1210
|
-
// src/core/
|
|
1215
|
+
// src/core/shared/schemas/type.ts
|
|
1216
|
+
var import_typebox3 = require("@sinclair/typebox");
|
|
1217
|
+
|
|
1218
|
+
// src/core/shared/constants.ts
|
|
1211
1219
|
var TYPED_INPUT_TYPES = [
|
|
1212
1220
|
"msg",
|
|
1213
1221
|
"flow",
|
|
@@ -1316,7 +1324,6 @@ var StatusPortSchema = import_typebox2.Type.Object({
|
|
|
1316
1324
|
});
|
|
1317
1325
|
|
|
1318
1326
|
// src/core/shared/schemas/type.ts
|
|
1319
|
-
var import_typebox3 = require("@sinclair/typebox");
|
|
1320
1327
|
var JSON_TYPES = /* @__PURE__ */ new Set([
|
|
1321
1328
|
"null",
|
|
1322
1329
|
"boolean",
|