@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/test/index.js CHANGED
@@ -356,6 +356,7 @@ var ValidationError = class _ValidationError extends Error {
356
356
 
357
357
  // src/core/server/validation.ts
358
358
  function initValidator(RED) {
359
+ if (RED.validator) return;
359
360
  const nrg = {
360
361
  validator: new Validator({
361
362
  customKeywords: [
package/types/server.d.ts CHANGED
@@ -516,7 +516,8 @@ export interface NodeConstructor<T = any, TConfig = any, TCredentials = any> {
516
516
  }
517
517
  type NodeConfig<TConfig = any> = TConfig & Static<typeof NodeConfigSchema>;
518
518
  type NodeCredentials<TCredentials = any> = TCredentials;
519
- interface INode<TConfig = any, TCredentials = any, TSettings = any> {
519
+ /** Public instance interface for all NRG nodes. Implemented by {@link Node}. */
520
+ export interface INode<TConfig = any, TCredentials = any, TSettings = any> {
520
521
  readonly config: NodeConfig<TConfig>;
521
522
  readonly id: string;
522
523
  readonly name: string | undefined;
@@ -619,13 +620,17 @@ export declare abstract class IONode<TConfig = any, TCredentials = any, TInput =
619
620
  get totalOutputs(): number;
620
621
  /**
621
622
  * Send a message to a specific output port by index or name.
622
- * Built-in ports: `"error"`, `"complete"`, `"status"` resolved automatically
623
- * based on the node's built-in port configuration.
623
+ * Built-in port `"status"` is resolved automatically based on the node's
624
+ * built-in port configuration.
624
625
  * Custom named ports are resolved from `outputsSchema` when it is a record.
625
626
  * Numeric indices refer to the base output ports (0-based).
627
+ *
628
+ * Note: `"error"` and `"complete"` ports are managed by the framework and
629
+ * cannot be sent to directly. Throw an error to trigger the error port,
630
+ * and the complete port is sent automatically on successful input processing.
626
631
  */
627
- sendToPort<P extends (keyof TOutput & string) | number | "error" | "complete" | "status">(port: P, msg: P extends keyof TOutput ? TOutput[P] : unknown): void;
628
- status(status: IONodeStatus): void;
632
+ sendToPort<P extends (TOutput extends Record<string, Record<string, any>> ? keyof TOutput & string : never) | number | "status">(port: P, msg: P extends keyof TOutput ? TOutput[P] : unknown): void;
633
+ status(status: IONodeStatus, data?: Record<string, unknown>): void;
629
634
  error(message: string, msg?: any): void;
630
635
  updateWires(wires: string[][]): void;
631
636
  receive(msg: TInput): void;
@@ -669,7 +674,7 @@ export interface IIONode<TConfig = any, TCredentials = any, TInput = any, TOutpu
669
674
  receive(msg: TInput): void;
670
675
  readonly baseOutputs: number;
671
676
  readonly totalOutputs: number;
672
- sendToPort<P extends (keyof TOutput & string) | number | "error" | "complete" | "status">(port: P, msg: P extends keyof TOutput ? TOutput[P] : unknown): void;
677
+ sendToPort<P extends (TOutput extends Record<string, Record<string, any>> ? keyof TOutput & string : never) | number | "status">(port: P, msg: P extends keyof TOutput ? TOutput[P] : unknown): void;
673
678
  }
674
679
  interface IONodeDefinition<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> {
675
680
  type: string;
@@ -27,12 +27,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
27
27
  }>, {}, {
28
28
  editorId: string;
29
29
  stateId: string;
30
+ trayElement: HTMLElement | null;
30
31
  }, {}, {
31
32
  mountEditor(): void;
32
33
  createEditorInstance(): void;
33
34
  createExpandeEditorTray(): void;
34
35
  onClickExpand(): void;
35
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
36
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "editor-ready" | "tray-open" | "tray-close")[], "update:value" | "editor-ready" | "tray-open" | "tray-close", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
36
37
  value: {
37
38
  type: StringConstructor;
38
39
  default: string;
@@ -60,6 +61,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
60
61
  };
61
62
  }>> & Readonly<{
62
63
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
64
+ "onEditor-ready"?: ((...args: any[]) => any) | undefined;
65
+ "onTray-open"?: ((...args: any[]) => any) | undefined;
66
+ "onTray-close"?: ((...args: any[]) => any) | undefined;
63
67
  }>, {
64
68
  label: string;
65
69
  icon: string;
@@ -572,12 +572,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
572
572
  }>, {}, {
573
573
  editorId: string;
574
574
  stateId: string;
575
+ trayElement: HTMLElement | null;
575
576
  }, {}, {
576
577
  mountEditor(): void;
577
578
  createEditorInstance(): void;
578
579
  createExpandeEditorTray(): void;
579
580
  onClickExpand(): void;
580
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
581
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "editor-ready" | "tray-open" | "tray-close")[], "update:value" | "editor-ready" | "tray-open" | "tray-close", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
581
582
  value: {
582
583
  type: StringConstructor;
583
584
  default: string;
@@ -605,6 +606,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
605
606
  };
606
607
  }>> & Readonly<{
607
608
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
609
+ "onEditor-ready"?: ((...args: any[]) => any) | undefined;
610
+ "onTray-open"?: ((...args: any[]) => any) | undefined;
611
+ "onTray-close"?: ((...args: any[]) => any) | undefined;
608
612
  }>, {
609
613
  label: string;
610
614
  icon: string;