@bonsae/nrg-runtime 0.23.0 → 0.24.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.23.0",
3
+ "version": "0.24.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
@@ -578,9 +578,10 @@ var IONode = class extends Node {
578
578
  try {
579
579
  nodeRedNode.log("Calling input");
580
580
  this.#currentInputMsg = msg;
581
- await Promise.resolve(this.#input(msg, send));
581
+ const result = await this.#input(msg, send);
582
582
  this.#sendToPort("complete", {
583
583
  ...msg,
584
+ ...result !== void 0 ? { output: result } : {},
584
585
  complete: {
585
586
  source: this.#nodeSource()
586
587
  },
@@ -616,6 +617,7 @@ var IONode = class extends Node {
616
617
  );
617
618
  }
618
619
  input(msg) {
620
+ return void 0;
619
621
  }
620
622
  async #input(msg, send) {
621
623
  const NodeClass = this.constructor;
@@ -630,7 +632,7 @@ var IONode = class extends Node {
630
632
  }
631
633
  this.#send = send;
632
634
  try {
633
- await Promise.resolve(this.input(msg));
635
+ return await Promise.resolve(this.input(msg));
634
636
  } finally {
635
637
  this.#send = void 0;
636
638
  }
package/types/server.d.ts CHANGED
@@ -727,7 +727,7 @@ export declare abstract class IONode<TConfig = any, TCredentials = any, TInput =
727
727
  protected readonly context: IONodeContext;
728
728
  constructor(RED: RED, node: NodeRedNode, config: IONodeConfig<TConfig>, credentials: IONodeCredentials<TCredentials>);
729
729
  [WIRE_HANDLERS](nodeRedNode: NodeRedNode, createdPromise: Promise<void>): void;
730
- input(msg: TInput): void | Promise<void>;
730
+ input(msg: TInput): unknown;
731
731
  send(msg: TOutput): void;
732
732
  get baseOutputs(): number;
733
733
  get totalOutputs(): number;
@@ -787,7 +787,7 @@ export interface IIONode<TConfig = any, TCredentials = any, TInput = any, TOutpu
787
787
  readonly y: number;
788
788
  readonly g: string | undefined;
789
789
  readonly wires: string[][];
790
- input(msg: TInput): void | Promise<void>;
790
+ input(msg: TInput): unknown;
791
791
  send(msg: TOutput): void;
792
792
  status(status: IONodeStatus): void;
793
793
  updateWires(wires: string[][]): void;
@@ -811,7 +811,7 @@ interface IONodeDefinition<TConfigSchema extends TSchema | undefined = undefined
811
811
  registered?(RED: RED): void | Promise<void>;
812
812
  created?(this: BoundIONode<TConfigSchema, TCredsSchema, TSettingsSchema, TInputSchema, TOutputsSchema>): void | Promise<void>;
813
813
  closed?(this: BoundIONode<TConfigSchema, TCredsSchema, TSettingsSchema, TInputSchema, TOutputsSchema>, removed?: boolean): void | Promise<void>;
814
- input?(this: BoundIONode<TConfigSchema, TCredsSchema, TSettingsSchema, TInputSchema, TOutputsSchema>, msg: InferOr<TInputSchema, any>): void | Promise<void>;
814
+ input?(this: BoundIONode<TConfigSchema, TCredsSchema, TSettingsSchema, TInputSchema, TOutputsSchema>, msg: InferOr<TInputSchema, any>): unknown;
815
815
  }
816
816
  /**
817
817
  * Base class for configuration nodes that are shared across multiple nodes