@bonsae/nrg-runtime 0.22.1 → 0.23.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonsae/nrg-runtime",
3
- "version": "0.22.1",
3
+ "version": "0.23.0",
4
4
  "description": "Runtime for Node-RED nodes built with @bonsae/nrg — no build tooling.",
5
5
  "author": "Allan Oricil <allanoricil@duck.com>",
6
6
  "license": "MIT",
package/server/index.cjs CHANGED
@@ -636,23 +636,14 @@ var IONode = class extends Node {
636
636
  }
637
637
  }
638
638
  send(msg) {
639
- const sendsValue = this.baseOutputs <= 1;
640
- if (Array.isArray(msg) && !sendsValue) {
641
- const slots = msg.slice(0, this.baseOutputs);
642
- const out = slots.map((m, port) => {
643
- if (m == null) return m;
644
- this.#validatePort(m, port);
645
- return this.#wrapOutgoing(m, this.#resolveContextMode(port), port);
646
- });
647
- this.#deliver(out);
648
- return;
649
- }
650
- if (msg == null) {
651
- this.#deliver(msg);
652
- return;
653
- }
654
- this.#validatePort(msg, 0);
655
- this.#deliver(this.#wrapOutgoing(msg, this.#resolveContextMode(0), 0));
639
+ const multi = this.baseOutputs > 1 && Array.isArray(msg);
640
+ const values = multi ? msg.slice(0, this.baseOutputs) : [msg];
641
+ const out = values.map((m, port) => {
642
+ if (m == null) return m;
643
+ this.#validatePort(m, port);
644
+ return this.#wrapOutgoing(m, this.#resolveContextMode(port), port);
645
+ });
646
+ this.#deliver(out);
656
647
  }
657
648
  #deliver(out) {
658
649
  if (this.#send) {
package/types/server.d.ts CHANGED
@@ -899,7 +899,7 @@ export declare function registerTypes(nodes: NodeConstructor[]): RegistrationFun
899
899
  * });
900
900
  * ```
901
901
  */
902
- export declare function defineIONode<TConfigSchema extends TSchema | undefined = undefined, TCredsSchema extends TSchema | undefined = undefined, TSettingsSchema extends TSchema | undefined = undefined, TInputSchema extends TSchema | undefined = undefined, TOutputsSchema extends TSchema | readonly TSchema[] | Record<string, TSchema> | undefined = undefined>(def: IONodeDefinition<TConfigSchema, TCredsSchema, TSettingsSchema, TInputSchema, TOutputsSchema>): NodeConstructor<IIONode<InferOr<TConfigSchema, any>, InferOr<TCredsSchema, any>, InferOr<TInputSchema, any>, InferOutputs<TOutputsSchema>>>;
902
+ export declare function defineIONode<TConfigSchema extends TSchema | undefined = undefined, TCredsSchema extends TSchema | undefined = undefined, TSettingsSchema extends TSchema | undefined = undefined, TInputSchema extends TSchema | undefined = undefined, const TOutputsSchema extends TSchema | readonly TSchema[] | Record<string, TSchema> | undefined = undefined>(def: IONodeDefinition<TConfigSchema, TCredsSchema, TSettingsSchema, TInputSchema, TOutputsSchema>): NodeConstructor<IIONode<InferOr<TConfigSchema, any>, InferOr<TCredsSchema, any>, InferOr<TInputSchema, any>, InferOutputs<TOutputsSchema>>>;
903
903
  /**
904
904
  * Creates a config node class from a definition object.
905
905
  *